![]() |
#2
诸葛修勤2013-11-07 01:15
|

<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>用户登录</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script language="javascript" src="javascript/code/code.js"></script>
<link rel="stylesheet" type="text/css" href="javascript/code/code.css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
background-image: url(image/loginindex.jpg);
}
#Layer1 {
position: absolute;
width: 414px;
height: 188px;
z-index: 1;
left: 164px;
top: 452px;
}
-->
</style>
</head>
<EMBED src="/petshop/music/karo.mp3" autostart="true" loop="true"
hidden="true"></EMBED>
<script type="text/javascript">
function checkform(){
$user_name=document.getElementById("username").value;
$user_pwd=document.getElementById("password").value;
var inputCode = document.getElementById("input1").value.toUpperCase();
var codeToUp = code.toUpperCase();
if (inputCode.length <= 0) {
alert("请输入验证码!");
return false;
} else if (inputCode != codeToUp) {
alert("验证码输入错误!");
createCode();
return false;
} else if($user_name==''){
alert("用户名不能为空");
return false;
}else if($user_pwd=='')
{
alert("密码不能为空");
return false;
}
}
return true;
}
}
</script>
<body onLoad="createCode();">
<form action="/petshop/servlet/loginservlet" method="get" name="form1"
id="form1" onSubmit="return checkform()">
<div id="Layer1">
<table cellpadding="0" cellspacing="0">
<tr>
<td width="87">
用户名:
</td>
<td width="325">
<input type="text" name="username" id="username"
title="请输入用户名,6~18个字符,可使用字母、数字、下划线,需以字母开头" maxlength="16" />
<font color="ff0000"> <%
if ((String) session.getAttribute("unerror") != null) {
out.print((String) session.getAttribute("unerror"));
}
%> </font>
</td>
</tr>
<tr>
<td>
密码:
</td>
<td>
<input type="password" name="password" id="password"
title="请输入密码" maxlength="20" />
<font color="ff0000"> <%
if ((String) session.getAttribute("pwderror") != null) {
out.print((String) session.getAttribute("pwderror"));
}
%> </font>
</td>
</tr>
<tr>
<td>
验证码:
</td>
<td>
<input name="text" type="text" id="input1" />
<input name="text" type="text" class="code" id="checkCode"
style="width: 55px" />
<a href="#" onClick="createCode()">看不清楚</a>
</td>
</tr>
<tr>
<td>
<input type="submit" name="button" id="button" value="登陆" />
</td>
<td>
<input type="reset" name="reset" id="reset" value="重置" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>