标签:
1.form表单有一个onsubmit属性:
<form method="post" action="" onsubmit="return verity();"> <input name="studentName" value="" type="text"/> </form>
2.写一个javascript脚本:
<script type="text/javascript"> function verity() { var Name = $(‘[name="studentName"]‘).val(); if (Name == null || "" == Name) { alert("请输入学生姓名!"); return false; } } </script>
标签:
原文地址:http://www.cnblogs.com/chaoge66/p/5576317.html