javascript 判断用户输入文本框是否为空 ﹏ヽ暗。殇╰゛Y 2023-10-16 19:42 4阅读 0赞 楼主要确认密码么,要是不用可以直接去掉就可以了 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>MyHtml.html</title> <script type="text/javascript"> <!-- function check() { if(form1.text1.value=="") {alert("请输入用户名!"); return false;} if(form1.password1.value=="") {alert("请输入密码!") return false; } if(form1.password2.value=="") {alert("请输入确认密码!") return false; } } //--></script> </head> <body> <form action="" method="post" name="form1" οnsubmit="return check()"> <h2 align="center"><font color="red"> 用户注册页面</font></h2> <table align="center" border="2"> <tr><td>用户名:</td><td><input type="text" name="text1" size="22" οnblur="check()"></td> </tr> <tr><td>密 码:</td><td><input type="password" name="password1" size="22" οnblur="check()"></td></tr> <tr><td>确认密码:</td><td><input type="password" name="password2" size="22" οnblur="check()"></td></tr> <tr><td align="center" colspan="2"><input type="submit" value="提交"> <input type="reset" value="重置"></td></tr> </table> </form> </body> </html>
还没有评论,来说两句吧...