如题,怎样通过脚本判断用户在页面上两次输入的密码是一致的?大家有什么好的想法,不妨讨论下。

解决方案 »

  1.   


    <!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=utf-8" />
    <title>无标题文档</title><script>
    function isPsSame()
    {
    if (document.myform.ps1.value==document.myform.ps2.value)
    {
    alert("ok");
    return true;
    }
    else
    {
    alert("no same");
    return false;
    }
    }
    </script>
    </head><body>
    <form name="myform" method="post" action="" onsubmit="return isPsSame();">
      <input type="password" name="ps1" />
      <input type="password" name="ps2" />
      
      <input type="submit" name="button" id="button" value="提交"/>
    </form>
    </body>
    </html>