JS表单验证
<script language="javascript" type="text/javascript"> function checkSubmit() { if (document.form1.jtitle.value=="") { alert("对不起,请输入标题!"); document.form1.jtitle.focus(); return false; } } </script> <form id="form1" onsubmit="javascript:return checkSubmit();" > <input type="text" name="jname"/> <input type="submit" name="submit"/> </form>