codecamp

window属性:onselect

onselect属性

窗口中的select事件的事件处理程序。

onselect属性语法

window.onselect = funcRef ;
  • funcRef是一个函数。

onselect属性示例

<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 event detected!");
}
</script>
</head>

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

笔记

select事件仅在文本输入或textarea内的文本被选中时触发。文本被选中后,该事件被触发。

规范

规范状态注释
HTML Living Standard
规范中的'onselect'的定义。
Living Standard
 

浏览器兼容性

我们正在将兼容性数据转换为机器可读的JSON格式。 

  • 电脑端
特征Chrome
Edge
Firefox(Gecko)
Internet Explorer
Opera
Safari(WebKit)
基本支持支持支持
  • 移动端

特征AndroidAndroid WebviewChrome for AndroidEdgeFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari Mobile
基本支持?支持支持支持?????
window属性:onscroll
window属性:onselectionchange
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定