aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/globaleventhandlers/onblur/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ru/web/api/globaleventhandlers/onblur/index.html')
-rw-r--r--files/ru/web/api/globaleventhandlers/onblur/index.html85
1 files changed, 85 insertions, 0 deletions
diff --git a/files/ru/web/api/globaleventhandlers/onblur/index.html b/files/ru/web/api/globaleventhandlers/onblur/index.html
new file mode 100644
index 0000000000..435313c2d8
--- /dev/null
+++ b/files/ru/web/api/globaleventhandlers/onblur/index.html
@@ -0,0 +1,85 @@
+---
+title: GlobalEventHandlers.onblur
+slug: Web/API/GlobalEventHandlers/onblur
+translation_of: Web/API/GlobalEventHandlers/onblur
+---
+<div>{{ApiRef("HTML DOM")}}</div>
+
+<p>Свойство <code><strong>onblur</strong></code> из {{domxref("GlobalEventHandlers")}} событий {{domxref("EventHandler")}} для {{event("blur")}} события. Оно доступно для{{domxref("Element")}}, {{domxref("Document")}} и {{domxref("Window")}}.</p>
+
+<p>Событие <code>blur</code> возникает когда элемент теряет фокус.</p>
+
+<div class="blockIndicator note">
+<p><strong>Note:</strong> Обратным <code>onblur</code> является {{domxref("GlobalEventHandlers.onfocus", "onfocus")}}.</p>
+</div>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox"><em>target</em>.onblur = <em>functionRef</em>;
+</pre>
+
+<h3 id="Value">Value</h3>
+
+<p><code>functionRef</code>  - это имя функции или <a href="/en-US/docs/Web/JavaScript/Reference/Operators/function">function expression</a>. Функция получает объект {{domxref("FocusEvent")}} в качестве единственного аргумента.</p>
+
+<h2 id="Example">Example</h2>
+
+<p>В этом примере <code>onblur</code> и {{domxref("GlobalEventHandlers.onfocus", "onfocus")}} используются для изменения текста в элементе {{HtmlElement("input")}}.</p>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html">&lt;input type="text" value="CLICK HERE"&gt;
+</pre>
+
+<h3 id="JavaScript">JavaScript</h3>
+
+<pre class="brush: js">let input = document.querySelector('input');
+
+input.onblur = inputBlur;
+input.onfocus = inputFocus;
+
+function inputBlur() {
+ input.value = 'Focus has been lost';
+}
+
+function inputFocus() {
+ input.value = 'Focus is here';
+}</pre>
+
+<h3 id="Result_2">Result</h3>
+
+<p>Нажимайте внутри и вне поля формы. Содержимое будет изменятся.</p>
+
+<p id="Result">{{EmbedLiveSample('Example')}}</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="spectable standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML WHATWG','webappapis.html#handler-onblur','onblur')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("api.GlobalEventHandlers.onblur")}}</p>
+
+<p>In contrast to IE, in which almost all kinds of elements receive the <code>blur</code> event, only a few kinds of elements on Gecko browsers work with this event.</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{event("blur")}} event</li>
+ <li>Related event handler: {{domxref("GlobalEventHandlers.onfocus")}}</li>
+</ul>