js 验证密码

来源:互联网 发布:淘宝上虚拟充值软件 编辑:程序博客网 时间:2024/06/05 18:11
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'register.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" language="JavaScript">
function passwordIsSame(){
var password=document.userForm.password.value;
var rePassword=document.userForm.rePassword.value;
  if(password!="" && rePassword!=""){
   if(password==rePassword){ 
   managerForm.newpasswod.focus(); 
   return true;   }
    }
    window.alert("非法操作"); 
  return false;
}
</script>
  </head>
  
  <body>
    <form name="userForm" action="registerDeal.jsp" method="post" onsubmit="return passwordIsSame()">
    用户名:<input name="name" type="text"/><br/>
    密    码:<input name="password" type="text"/><br/>
    确认密码:<input name="rePassword" type="text"/><br/>
    <input type="submit" value="register">
    <input type="reset" value="reset">
    </form>
  </body>
</html>