首页 > 代码库 > 登录页面

登录页面

<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>登录</title>
<script type="text/javascript" language="javascript">
function imgChange(){
f.img.src = "http://www.mamicode.com/image.jsp" ;
//alert(f.img.src) ;
}
function check(){
if(f.name.valuehttp://www.mamicode.com/=="")
{
alert("登录名称不能为空") ;
f.name.focus() ;
return false ;
}
if(f.pwd.valuehttp://www.mamicode.com/=="")
{
alert("登录密码不能为空") ;
f.pwd.focus() ;
return false;
}
if(f.Code.valuehttp://www.mamicode.com/=="")
{
alert("验证码不能为空") ;
f.Code.focus() ;
return false;
}
return true ;
}
</script>
<link href="http://www.mamicode.com/css/index.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<center>
<h2>超级管理员登录</h2>
<form action="login_check.jsp" method ="post" name="f">
<table>
<tr>
<td>用户名:</td>
<td><input type ="text" name="name" value=""/></td>
</tr>
<tr>
<td>密码:</td>
<td><input type ="password" name="pwd" value=""/></td>
</tr>
<tr>
<td>验证码:</td>
<td><input name="Code" type="text" id="Code" size="4" style="border:solid 1px #27B3FE; height:20px; background-color:#FFFFFF" maxlength="4">
<img name="img" border=0 src="http://www.mamicode.com/image.jsp" width="60" height="24" alt=“验证码”/>
<a href="javascript:;"><font size="2">看不清,换一张</font></a></td>
</tr>
<tr>
<td colspan="2" >
<center>
<input type="submit" value="http://www.mamicode.com/提交" onClick="check()"/>
<input type="reset" value="http://www.mamicode.com/重置"/>
</center>
</td>
</tr>
</table>
</form>
<%
if(request.getParameter("submit")!=null){
//先拿到验证码本身图片上的真实4个数字
String rcode = (String)session.getAttribute("rand");
//获取用户输入的验证码
String code = request.getParameter("code");
//判断用户输入的是否正确
if(rcode.equals(code)){
%>
验证码正确!!
<%
}else{
%>
验证码不正确!!
<%
}

}
%>
</center>
</body>
</html>

登录页面