用javascript实现用户登录验证

 1 <script language=javascript>
 2 function checkSubmit()
 3 {
 4     if ((document.form1.name.value)=="")
 5     {
 6         window.alert ('姓名必须填写');
 7         document.form1.name.select();
 8         document.form1.name.focus();
 9         return false;
10     }
11     else
12         return true;
13 }
14 </script>
15 <form name=”form1″ onsubmit=”javascript:return checkSubmit()”>
16 <input type=”text” name=”name”>
17 </form>

 

posted @ 2015-08-02 15:29  淳安梁朝伟  阅读(1225)  评论(0编辑  收藏  举报