javascript onselect attribute


  Translation results:

on

英[ɒn]   美[ɑ:n]  

prep. (indicating direction) to; (indicating object) to; (indicating position) on...; (indicating time) at the time of...

adv. (put, wear, connect) on; forward, (continue) go on

adj. active situation, state ;used; happening; planned

select

英[sɪˈlekt] 美[sɪˈlɛkt]

vt.Select; select ;Select

adj.selected;selected;choose;〈口〉choosy, picky

Third person singular: selects Present participle: selecting past Formula: selected past participle: selected

javascript onselect attributesyntax

Function: Occurs when the text in the text box is selected.

Syntax: onselect="SomeJavaScriptCode"

Parameters: SomeJavaScriptCode Required. Specifies the JavaScript to be executed when this event occurs.​

javascript onselect attributeexample

<html>
<head>
    <meta charset="UTF-8">

</head>

<body>

<form>

Select text: <input type="text" value="Hello world!"
onselect="alert('你选中了文本.')" />
<br /><br />
Select text: <textarea cols="20" rows="5"
onselect="alert('你选中了文本.')">
Hello world!</textarea>
<p>选中文本框中的内容触发事件</p>
</form>

</body>

</html>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A