From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../api/globaleventhandlers/onselect/index.html | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 files/zh-cn/web/api/globaleventhandlers/onselect/index.html (limited to 'files/zh-cn/web/api/globaleventhandlers/onselect') 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 +--- +

{{ ApiRef() }}

+ +

概述

+ +

onselect用来获取或设置当前窗口的select事件的事件处理函数

+ +

语法

+ +
window.onselect = funcRef;
+
+ + + +

例子

+ +
<html>
+<head>
+
+<title>onselect test</title>
+
+<style type="text/css">
+.text1 { border: 2px solid red; }
+</style>
+
+<script type="text/javascript">
+
+window.onselect = selectText;
+
+function selectText()
+{
+ alert("检测到select事件!");
+}
+</script>
+</head>
+
+<body>
+<textarea class="text1" cols="30" rows="3">
+用鼠标高亮选择一些文本,来触发select事件
+</textarea>
+</body>
+</html>
+
+ +

备注

+ +

只有在文本框和文本域内选择文本才会触发select事件.

+ +

规范

+ +

不属于任何公开规范.

+ +

{{ languages( {"en": "en/DOM/window.onselect" } ) }}

-- cgit v1.2.3-54-g00ecf