We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

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
HTML Living Standard
onsubmit
Living Standard  

文档标签和贡献者

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