日期:2014-05-16 浏览次数:20418 次
html> <head> <title>Earnest Bank Web</title> <script type="text/javascript" language= "JavaScript"> function show() { var useID=i.value; var usep=p.value; var IDlength=useID.length; var PWlength=usep.length; if(IDlength>8){ alert( "ID不超过8个字符 "); i.fouse(); } else if(PWlength>5) { alert( "密码不能超过5个字符 "); p.fouse(); } } </script> </head> <body> <h1 align=center> Earnest Bank </h1> <table align=center> <caption> 登录 </caption> <tr> <td> ID </td> <td><input type="text" name="i"> </td> </tr> <tr> <td> password </td> <td><input type="password" name="p"> </td> </tr> <tr align=center> <td colspan=2><input type="button" value= "确定" onClick="show()"> </td> </tr>
------解决方案--------------------
写错了把 正常没问题的
------解决方案--------------------
<script language= "JavaScript "> function show() { var useID=document.getElementById("i"); var usep=document.getElementById("p"); if(useID.length>=8){ alert( "ID不超过8个字符 "); useID.focus(); } else if(usep.length>=5) { alert( "密码不能超过5个字符 "); usep.focus(); } } </script>