onselect 事件
實例
當文本被選中時,執行一段 Javascript代碼:
<input type="text" onselect="myFunction">
定義和用法
onselect 事件會在文本框中的文本被選中時發生。
語法
HTML 中:
<element
onselect="SomeJavaScriptCode">
JavaScript 中:
object.onselect=function(){SomeJavaScriptCode}
參數 | 描述 |
---|---|
SomeJavaScriptCode | 必需。規定該事件發生時執行的 JavaScript。 |
流覽器支持
所有主要流覽器都支持 onselect 事件
onselect 在 HTML 中
onselect 屬性可用於: <input type="file">, <input type="password">, <input type="text">, <keygen>, 和 <textarea>.
