码迷,mamicode.com
首页 > 其他好文 > 详细

登录页面

时间:2014-12-17 22:36:45      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:style   http   ar   io   color   os   sp   for   java   

<%@ 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 = "image.jsp" ;
//alert(f.img.src) ;
}
function check(){
if(f.name.value=="")
{
alert("登录名称不能为空") ;
f.name.focus() ;
return false ;
}
if(f.pwd.value=="")
{
alert("登录密码不能为空") ;
f.pwd.focus() ;
return false;
}
if(f.Code.value=="")
{
alert("验证码不能为空") ;
f.Code.focus() ;
return false;
}
return true ;
}
</script>
<link href="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="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="提交" onClick="check()"/>
<input type="reset" value="重置"/>
</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>

登录页面

标签:style   http   ar   io   color   os   sp   for   java   

原文地址:http://www.cnblogs.com/LovePinkAngel/p/Angel.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!