diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/htmlformelement/submit | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/htmlformelement/submit')
-rw-r--r-- | files/zh-cn/web/api/htmlformelement/submit/index.html | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlformelement/submit/index.html b/files/zh-cn/web/api/htmlformelement/submit/index.html new file mode 100644 index 0000000000..7e13885446 --- /dev/null +++ b/files/zh-cn/web/api/htmlformelement/submit/index.html @@ -0,0 +1,42 @@ +--- +title: form.submit +slug: Web/API/HTMLFormElement/submit +tags: + - API + - HTML DOM + - 参考 + - 方法 + - 表单元素 +translation_of: Web/API/HTMLFormElement/submit +--- +<p>{{ ApiRef() }}</p> + +<p> <strong><code>HTMLFormElement.submit()</code></strong>用来提交表单。</p> + +<p>这个方法和触发提交表单按钮很类似,但有所不同:</p> + +<ul> + <li>No {{event("submit")}} event is raised. In particular, the form's {{domxref("GlobalEventHandlers.onsubmit", "onsubmit")}} event handler is not run.</li> + <li><a href="/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation">Constraint validation</a> is not triggered.</li> +</ul> + +<p>如果一个表单控件(比如一个提交按钮)的 <code>name</code> 或 <code>id</code> 的值为 <code>submit</code>,则它将覆盖表单的 submit 方法.</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox notranslate"><em>HTMLFormElement</em>.submit()</pre> + +<h2 id="例子">例子</h2> + +<pre class="brush: js notranslate">document.forms["myform"].submit(); +</pre> + +<h2 id="规范">规范</h2> + +<p><a href="https://html.spec.whatwg.org/multipage/forms.html#the-form-element">HTML Living standard: The form element</a></p> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.HTMLFormElement.submit")}}</p> |