HTML事件属性onselect
2018-01-05 13:58 更新
HTML事件属性onselect
触发 onselect
属性事件在一个元素中选择文本后。
HTML5中的新功能
没有。
句法
<elementName onselect="script">
支持的标签
<input type="file">, <input type="password">, <input type="text">, <keygen>, <textarea>
浏览器兼容性
![]() |
![]() |
![]() |
![]() |
![]() |
|
---|---|---|---|---|---|
onselect |
Yes | Yes | Yes | Yes | Yes |
例子
<!DOCTYPE html>
<html>
<body>
Some text: <input type="text" value="Select me!!" onselect="myFunction()">
<script>
function myFunction() {
console.log("You have selected some text!");
}
</script>
</body>
</html>
以上内容是否对您有帮助:
更多建议: