aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/globaleventhandlers/onselect/index.html
blob: 69dc11014b205a0ea2c86d6179430db7b0449022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
title: GlobalEventHandlers.onselect
slug: Web/API/GlobalEventHandlers/onselect
translation_of: Web/API/GlobalEventHandlers/onselect
---
<div>
<div>{{ ApiRef("HTML DOM") }}</div>
</div>

<p>Обработчик события select окна браузера.</p>

<h2 id="Syntax">Синтаксис</h2>

<pre class="syntaxbox">window.onselect = <em>funcRef</em>;
</pre>

<ul>
 <li><code>funcRef</code> - функция</li>
</ul>

<h2 id="Example">Пример</h2>

<pre class="brush: html">&lt;html&gt;
&lt;head&gt;

&lt;title&gt;onselect test&lt;/title&gt;

&lt;style type="text/css"&gt;
.text1 { border: 2px solid red; }
&lt;/style&gt;

&lt;script type="text/javascript"&gt;

window.onselect = selectText;

function selectText()
{
 alert("select event detected!");
}
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;textarea class="text1" cols="30" rows="3"&gt;
Highlight some of this text
with the mouse pointer
to fire the onselect event.
&lt;/textarea&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>

<h2 id="Notes">Замечание</h2>

<p>Событие select происходит только, когда текст выделяют в поле input с type='text' или в поле textarea. Событие происходит только после того, как текст будет выделен.</p>

<h2 id="Specification">Спецификация</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-onselect','onselect')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>