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>

  

posted @ 2012-02-06 15:21  cyjch  阅读(256)  评论(0编辑  收藏  举报