<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
<style type="text/css">
.code
{
background-image:url(code.jpg);
font-family:Arial;
font-style:italic;
color:Red;
border:0;
padding:2px 3px;
letter-spacing:3px;
font-weight:bolder;
}
.unchanged
{
border:0;
}
</style>
<script language="javascript">
var code ; //在全局 定义验证码
function createCode()
{
code = "";
var codeLength = 6;//验证码的长度
var checkCode = document.getElementById("checkCode");
var selectChar = new Array(0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');//所有候选组成验证码的字符,当然也可以用中文的
for(var i=0;i<codeLength;i++)
{
var charIndex = Math.floor(Math.random()*36);
code +=selectChar[charIndex];
}
// alert(code);
if(checkCode)
{
checkCode.className="code";
checkCode.value = code;
}
}
function validate(form)
{
var inputCode = document.getElementById("input1").value;
if(inputCode != code )
{
alert("验证码为空或者输入错误!");
createCode();//刷新验证码
form.input1.focus();
return false;
}
}
</script>
<link href="../css/StyleSheet.css" rel="stylesheet" type="text/css" />
<title>管理员登录</title>
</head>
<<body onload="createCode()">
<br />
<br />
<br />
<br />
<form id="form" name="form" method="post" onsubmit="return validate(form)"
action="admin.do?method=operatorLogin"/>
<table align="center" width="600" border="0" cellpadding="8"
cellspacing="0" class="logintable">
<tr class="loginheader">
<td width="80"></td>
<td width="100"></td>
<td colspan="2"></td>
<td width="120"></td>
<td width="80"></td>
</tr>
<tr style="height: 40px">
<td>
</td>
<td colspan="4" class="line1">
<span class="STYLE1">管理员系统登录页面</span>
</td>
<td>
</td>
</tr>
<tr>
<tr>
<td>
</td>
<td class="line2">
</td>
<td colspan="2" class="line2">
</td>
<td class="line2">
</td>
<td>
</td>
</tr>
<tr>
<td colspan="2">
<%
if (request.getAttribute("flag") != null) {
%>
用户名或密码输入有误!
<%
}
%>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
用户名:
</td>
<td colspan="2">
<input type="text" name="name" />
</td>
<td></td>
<td>
</td>
</tr>
<tr>
<td style="height: 32px">
</td>
<td align="right" style="height: 32px">
密 码:
</td>
<td colspan="2" style="height: 32px">
<input type="password" name="password" />
</td>
<td style="height: 32px">
</td>
<td style="height: 32px">
</td>
</tr>
<tr>
<td style="height: 29px">
</td>
<td align="right" class="line1" style="height: 29px">
</td>
<td class="line1" style="width: 71px; height: 29px;">
</td>
<td class="line1" style="height: 29px">
</td>
<td class="line1" style="height: 29px; font-size: 12px"></td>
<td style="height: 29px">
</td>
</tr>
<tr>
<td>
</td>
<td class="line2">
</td>
<td colspan="2" class="line2">
<div align="center">
验证码: <input type="text" id="input1" />
<input type="text" readonly="readonly" id="checkCode" class="unchanged" style="width: 80px" /><br />
<input type="submit" width="20" name="Submit" value="提交" onclick="return checklog(form);"
/>
<a href="#" onclick="createCode()">换一张</a>
<input type="reset" name="Submit2" value="重置" />
</div>
</td>
<td class="line2">
</td>
<td>
</td>
</tr>
<tr>
<td colspan="6" style="text-align: center; font-size: 12px">
Powered by
<a href="#" target="_blank" style="color: #fff"></a> ©
2008 SunYang
<a href="#" target="_blank" style="color: #fff"> Inc.</a>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td colspan="2">
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</form>
</body>
</html>
<SCRIPT type="text/javascript" >
function checklog(form){
if (form.name.value==""){
alert("请输入管理员名称!");form.name.focus();return false;
}
if (form.password.value==""){
alert("请输入管理员密码!");form.password.focus();return false;
}
}
</SCRIPT>