Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

GlobalEventHandlers.onselect

概述

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

语法

window.onselect = funcRef;
  • 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事件.

规范

不属于任何公开规范.

文档标签和贡献者

 此页面的贡献者: teoli, jsx, ziyunfei
 最后编辑者: teoli,