onsubmlt阻止表单提交

来源:互联网 发布:js indexof 多个 编辑:程序博客网 时间:2024/05/19 16:23
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><script language="javascript">//--->function checksubmit(){  if (document.form1.myname.value=="")        {           alert("请输入开始数值!");           document.form1.myname.focus();           return false;        }           return true;  }//---></script><form name="form1" method="post" action="#" onsubmit="return checksubmit()">  <label>  <input name="myname" type="text" id="id">  </label>  <p>    <label>    <input type="submit" name="Submit" value="提交">    </label>  </p></form>
0 0