java web 程序---注册页面密码验证
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <script type="text/javascript"> function getFocus(){ document.getElementById("user"); } function check(){ var pass=document.getElementById("pass").value; var pass1=document.getElementById("pass1").value; if(pass!=pass1){ document.getElementById("bbb").innerHTML="两次不一样" }else{ document.getElementById("bbb").innerHTML=""; } } </script> </head> <body> <center> 注册 <form> <table> <tr><td>用户名:</td><td><input type="text" name="user" id="user"/></td></tr> <tr><td>密码:</td><td><input type="password" name="pass" id="pass"/></td></tr> <tr><td>确认密码:</td><td><input type="password" name="pass2" id="pass1" onblur="check()"/></td> <td id="bbb"></td> </tr> <tr><td></td><td><input type="submit" value="注册"/></td></tr> </table> </form> </center> </body> </html>