English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML onselect-Ereignisattribut

onselect wird verwendet, um den Ereignishandler für das select-Ereignis des aktuellen Fensters zu erhalten oder zu setzen

HTML Event Attributes

Online-Beispiel

Führe JavaScript aus, nachdem einige Text im <input>-Element ausgewählt wurden

<!DOCTYPE html>
<html>
<head>
<title>Verwendung der HTML onselect-Eventattribut (Grundlagen-Tutorial-Website oldtoolbag.com)</title>
<script>
function showMsg()
{
 alert("Du hast einige Textinformationen ausgewählt!");
}
</script>
</head>
<body>
Einige Text: <input type="text" value="Wähle mich!!" onselect="showMsg()">
<p>showMsg() function is triggered when text information in the input field is selected. This function pops up some information./p>
</body>
</html>
Test see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the onselect event attribute

Definition and Usage

The onselect attribute is triggered when some text is selected in the element.

The onselect attribute can be used with the following elements: <input type="file">, <input type="password">, <input type="text">, <keygen>, and <textarea>.

HTML 4.01 and HTML5differences between

No differences.

Syntax

<element onselect="script">

Attribute Value

ValueDescription
scriptSpecifies the script to be executed when the onselect event is triggered.
HTML Event Attributes