From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../api/globaleventhandlers/onsubmit/index.html | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 files/ru/web/api/globaleventhandlers/onsubmit/index.html (limited to 'files/ru/web/api/globaleventhandlers/onsubmit') diff --git a/files/ru/web/api/globaleventhandlers/onsubmit/index.html b/files/ru/web/api/globaleventhandlers/onsubmit/index.html new file mode 100644 index 0000000000..35b3a7d1f0 --- /dev/null +++ b/files/ru/web/api/globaleventhandlers/onsubmit/index.html @@ -0,0 +1,65 @@ +--- +title: GlobalEventHandlers.onsubmit +slug: Web/API/GlobalEventHandlers/onsubmit +translation_of: Web/API/GlobalEventHandlers/onsubmit +--- +
{{ApiRef("HTML DOM")}}
+ +

Обработчик события отправки формы

+ +

Синтаксис

+ +
window.onsubmit = funcRef;
+
+ +

Параметры

+ + + +

Пример

+ +
<html>
+<script>
+function reg() {
+  window.captureEvents(Event.SUBMIT);
+  window.onsubmit = hit;
+}
+
+function hit() {
+  console.log('hit');
+}
+</script>
+
+<body onload="reg();">
+<form>
+  <input type="submit" value="submit" />
+</form>
+<div id="d"> </div>
+</body>
+</html>
+
+ +

Замечания

+ +

Событие submit возникает, когда пользователь кликает на кнопку "Отправить" в форме (<input type="submit"/>)

+ +

Событие submit не возникает, когда пользователь вызывает функцию form.submit() напрямую

+ +

Спецификации

+ + + + + + + + + + + + + + +
СпецификацииСтатусКомментарий
{{SpecName('HTML WHATWG','webappapis.html#handler-onsubmit','onsubmit')}}{{Spec2('HTML WHATWG')}} 
-- cgit v1.2.3-54-g00ecf