日期:2014-05-16  浏览次数:20326 次

帮忙看一下onsubmit
[color=#FF0000][/color] <script type="text/javascript">
function ismatch()
  {
  var email=document.getElementById("email").value;
  var regex=/.+@.+/;
  if(regex.test(email))
  {
  return true;
  }
  else {alert("格式不正确!");return false;}

  }
  </script>
<form id="form3" action="wang.aspx" onsubmit="return ismatch();">
<input type="text" id="email" />
<input type="submit" value="submit"/>
<input type="button" value="提交" onclick="this.form.onsubmit();"/>
</form>
请问一下,红字的一行onclick="this.form.onsubmit();"为什么点击按钮时无法触发onsubmit="return ismatch();"呢?

------解决方案--------------------
单独运行这段代码并没什么问题!!楼主你是嵌套在那里用吗?还是有其他的文件影响了。