- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>无标题文档</title>
- <script language="javascript">
- function onsub(){
- var mima1 = document.getElementById("mima1").value;
- var mima2 = document.getElementById("mima2").value;
- if(mima1!=mima2)
- {
- alert("两个密码不同");
- return false;
- }
- }
- </script>
- </head>
- <body>
- <form action="" onsubmit="return onsub();" method=post>
- 密码:<input type="txt" id="mima1" value="">
- 确认密码:<input type="password" id="mima2" value="">
- <input type="submit" value="提交"/>
- </form>
- </body>
- </html>
复制代码 这是我刚才做的,你可以看下,很简单的。 |