onselect
HTML onselect 事件属性
当选取 <input>
元素中的文本后执行 JavaScript:
<input type="text" onselect="showMsg() value="Hello world!">
定义和用法
onselect 属性在选取元素文本后触发。
onselect 属性可使用于以下元素: <input type="file">
, <input type="password">
, <input type="text">
, <keygen>
, 和 <textarea>
。
HTML 4.01 与 HTML5 之间的差异
无。
语法
<*element* onselect="*script*">
属性值
值 | 描述 |
---|---|
script | 规定该 onselect 事件触发时执行的脚本。 |
浏览器兼容性
select event |
---|