Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

GlobalEventHandlers.onsubmit

window 对象 submit 事件的事件句柄.

语法

window.onsubmit = funcRef;

参数

  • funcRef 是个函数引用

例子

<html>
<script>
function reg() {
  window.captureEvents(Event.SUBMIT);
  window.onsubmit = hit;
}
 
function hit() {
  alert('hit');
}
</script>

<body onload="reg();">
<form>
  <input type="submit" value="submit" />
</form>
<div id="d"> </div>
</body>
</html>

备注

当用户点击提交按钮(<input type="submit"/>)提交表单时,会触发submit事件.

规范

Specification Status Comment
WHATWG HTML Living Standard
onsubmit
Living Standard  

文档标签和贡献者

标签: 
 此页面的贡献者: Ende93, teoli, basemnassar11, ziyunfei
 最后编辑者: Ende93,