aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/globaleventhandlers/onselect
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/globaleventhandlers/onselect
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/globaleventhandlers/onselect')
-rw-r--r--files/zh-cn/web/api/globaleventhandlers/onselect/index.html59
1 files changed, 59 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/globaleventhandlers/onselect/index.html b/files/zh-cn/web/api/globaleventhandlers/onselect/index.html
new file mode 100644
index 0000000000..cba79e9a8f
--- /dev/null
+++ b/files/zh-cn/web/api/globaleventhandlers/onselect/index.html
@@ -0,0 +1,59 @@
+---
+title: GlobalEventHandlers.onselect
+slug: Web/API/GlobalEventHandlers/onselect
+translation_of: Web/API/GlobalEventHandlers/onselect
+---
+<p>{{ ApiRef() }}</p>
+
+<h3 id="Summary" name="Summary">概述</h3>
+
+<p><strong>onselect</strong>用来获取或设置当前窗口的select事件的事件处理函数</p>
+
+<h3 id="Syntax" name="Syntax">语法</h3>
+
+<pre class="eval">window.onselect = <em>funcRef</em>;
+</pre>
+
+<ul>
+ <li><code>funcRef是个函数引用</code>.</li>
+</ul>
+
+<h3 id="Example" name="Example">例子</h3>
+
+<pre>&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事件!");
+}
+&lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+&lt;textarea class="text1" cols="30" rows="3"&gt;
+用鼠标高亮选择一些文本,来触发select事件
+&lt;/textarea&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+</pre>
+
+<h3 id="Notes" name="Notes">备注</h3>
+
+<p>只有在文本框和文本域内选择文本才会触发select事件.</p>
+
+<h3 id="Specification" name="Specification">规范</h3>
+
+<p>不属于任何公开规范.</p>
+
+<p>{{ languages( {"en": "en/DOM/window.onselect" } ) }}</p>