HTML onselect 事件屬性
實例
當選取<input>元素中的文本後執行 JavaScript:
<input type="text" onselect="showMsg() value="Hello world!">
流覽器支持
所有主流流覽器都支持 onselect 事件屬性
定義和用法
onselect 屬性在選取元素文本後觸發。
onselect 屬性可使用於以下元素: <input type="file">, <input type="password">, <input type="text">, <keygen>, 和 <textarea>。
HTML 4.01 與 HTML5之間的差異
無。
語法
<element onselect="script">
屬性值
值 | 描述 |
---|---|
script | 規定該onselect事件觸發時執行的腳本。 |
