<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
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>My JSP '1.jsp' starting page</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 type="text/javascript" src="jquery-1.4.2.js" ></script>
<script>
$(function(){
var flag=false;
$("#name").blur(function(){
$("#vname").empty();
var name=$("#name").val();
if(name==null || name==""){
$("#name").after("<span style='color: red;' id='vname'>姓名不能为空</span>");
return flag;
}else{
$("#name").after("<span style='color: red;' id='vname'>√</span>");
flag=true;
return flag;
}
});
var flag2=false;
$("#password").blur(function(){
$("#vpassword").empty();
var password=$("#password").val();
if(password==null || password==""){
$("#password").after("<span style='color: red;' id='vpassword'>密码不能为空</span>");
return flag2;
}else{
$("#password").after("<span style='color: red;' id='vpassword'>√</span>");
flag2=true;
return flag2;
}
});
$("#tj").click(function(){
return flag && flag2;
});
});
</script>
</head>
<body>
<form action="user/login">
姓名:<input type="text" name="name" id="name"/><br/>
密码:<input type="password" name="password" id="password"/><br/>
<input type="submit" value="提交" id="tj"/><a href="index.jsp">注册</a>
<span id="tz"></span>
</form>
</body>
</html>
<%
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>My JSP '1.jsp' starting page</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 type="text/javascript" src="jquery-1.4.2.js" ></script>
<script>
$(function(){
var flag=false;
$("#name").blur(function(){
$("#vname").empty();
var name=$("#name").val();
if(name==null || name==""){
$("#name").after("<span style='color: red;' id='vname'>姓名不能为空</span>");
return flag;
}else{
$("#name").after("<span style='color: red;' id='vname'>√</span>");
flag=true;
return flag;
}
});
var flag2=false;
$("#password").blur(function(){
$("#vpassword").empty();
var password=$("#password").val();
if(password==null || password==""){
$("#password").after("<span style='color: red;' id='vpassword'>密码不能为空</span>");
return flag2;
}else{
$("#password").after("<span style='color: red;' id='vpassword'>√</span>");
flag2=true;
return flag2;
}
});
$("#tj").click(function(){
return flag && flag2;
});
});
</script>
</head>
<body>
<form action="user/login">
姓名:<input type="text" name="name" id="name"/><br/>
密码:<input type="password" name="password" id="password"/><br/>
<input type="submit" value="提交" id="tj"/><a href="index.jsp">注册</a>
<span id="tz"></span>
</form>
</body>
</html>