<script language=javascript> function checkform(){ //定义一个名为checkform的函数 if(document.form1.user.value=="") //检查表单1中的user文本框的值是否为空 { alert("用户名不能为空"); //使用alert方法弹出提示框 return false; } if(document.form1.upass.value!=document.form1.pass2.value) //检查表单1中的upass文本框的值和pass2文本框中的值是否不一样 { alert("两次密码不一致,请检查后重新输入"); //条件满足时,弹出相应的提示框 return false; } } </script> <form id="form1" name="form1" onsubmit="return checkform();">
表单的检验校对checkform
猜你喜欢
转载自www.cnblogs.com/sunyzone/p/12439144.html
今日推荐
周排行