--- title: submit slug: Web/API/HTMLFormElement/submit_event tags: - 事件 - 表单 - 表单事件 - 表单提交事件 translation_of: Web/API/HTMLFormElement/submit_event --- <p>当表单提交的时候触发submit事件</p> <p>注意submit事件只能作用于form元素,不能作用于button或者<input type="submit"></p> <h2 id="General_info">General info</h2> <dl> <dt style="float: left; text-align: right; width: 120px;">Specification</dt> <dd style="margin: 0 0 0 120px;"><a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#form-submission-algorithm">HTML5</a></dd> <dt style="float: left; text-align: right; width: 120px;">Interface</dt> <dd style="margin: 0 0 0 120px;">{{domxref("Event")}}</dd> <dt style="float: left; text-align: right; width: 120px;">Bubbles</dt> <dd style="margin: 0 0 0 120px;">Yes (although specified as a simple event that doesn't bubble)</dd> <dt style="float: left; text-align: right; width: 120px;">Cancelable</dt> <dd style="margin: 0 0 0 120px;">Yes</dd> <dt style="float: left; text-align: right; width: 120px;">Target</dt> <dd style="margin: 0 0 0 120px;">Element</dd> <dt style="float: left; text-align: right; width: 120px;">Default Action</dt> <dd style="margin: 0 0 0 120px;">Varies (send the content of the form to the server).</dd> </dl> <h2 id="Properties">Properties</h2> <table class="standard-table"> <thead> <tr> <th scope="col">Property</th> <th scope="col">Type</th> <th scope="col">Description</th> </tr> </thead> <tbody> <tr> <td><code>target</code> {{readonlyInline}}</td> <td>{{domxref("EventTarget")}}</td> <td>The event target (the topmost target in the DOM tree).</td> </tr> <tr> <td><code>type</code> {{readonlyInline}}</td> <td>{{domxref("DOMString")}}</td> <td>The type of event.</td> </tr> <tr> <td><code>bubbles</code> {{readonlyInline}}</td> <td>{{jsxref("Boolean")}}</td> <td>Whether the event normally bubbles or not.</td> </tr> <tr> <td><code>cancelable</code> {{readonlyInline}}</td> <td>{{jsxref("Boolean")}}</td> <td>Whether the event is cancellable or not.</td> </tr> </tbody> </table>