87,910
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Login.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
<script language="javascript" src="/lesson4/js/validation-framework.js"></script>
<div id="error" style="color:red;font-weight:bold"><div>
<form method="post" action="/lesson4/servlet/login" name="login" onsubmit="return doValidate(this)">
用户名:<input type="text" name="userName">
密 码 :<input type="password" name="userPassword">
<input type="submit" name="提交" value="提交"><input type="reset" name="重置" value="重置">
</form>
</body>
</html>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE validation-config SYSTEM "validation-config.dtd">
<validation-config lang="auto">
<form id="form1" show-error="error" show-type="all">
<field name="userName" display-name="用户名" onfail="">
<depend name="required" />
<depend name="commonChar" />
</field>
<field name="userPassword" display-name="密码">
<depend name="required" />
<depend name="commonChar" />
</field>
</form>
</validation-config>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Login.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
<script language="javascript">
function doValidate(f){
if(f.userName.value==''){alert('用户名为空!');f.userName.focus();return false;}
if(f.userPassword.value==''){alert('密码为空!');f.userPassword.focus();return false;}
}
</script>
<div id="error" style="color:red;font-weight:bold"><div>
<form method="post" action="/lesson4/servlet/login" name="login" onsubmit="return doValidate(this)">
用户名:<input type="text" name="userName">
密 码 :<input type="password" name="userPassword">
<input type="submit" name="提交" value="提交"><input type="reset" name="重置" value="重置">
</form>
</body>
</html>