日期:2014-05-19 浏览次数:20685 次
<html> <head> <script> function check() { var name = document.getElementById("name").value; var password = document.getElementById("password").value; var conform = document.getElementById("conform").value; if(name.length == 0) { alert('the account cannot empty'); return false; } if(name.length > 20) { alert('the account is too length'); return false; } //这里需要用ajax验证。。。自己去网上搜一下吧。。 if(name == 'abc') { alert('this account is exist'); return false; } if(password != conform) { alert('password not same'); return false; } } </script> </head> <body> <form action="a.html" method="post" onsubmit="return check()"> name:<input type="text" id="name" /><br/> password:<input type="password" id="password" /><br/> conform:<input type="password" id="conform" /><br/> <input type="submit" value="submit" /> </form> </body> </html>
------解决方案--------------------
绑定...........
------解决方案--------------------