Home >Web Front-end >HTML Tutorial >The event attribute onkeyup triggered when the user (on the keyboard) releases a key in html

The event attribute onkeyup triggered when the user (on the keyboard) releases a key in html

黄舟
黄舟Original
2017-11-06 09:37:412124browse

Example

Execute a section of JavaScript when the user relaxes the keystroke:

<input type="text" onkeyup="displayResult()">


Browser support

IE

Firefox

Chrome

Safari

Opera


All major browsers support onkeyup attribute.

Definition and Usage

The onkeyup attribute is triggered when the user releases a key (on the keyboard).

Tip: The order of events relative to the onkeyup event:

onkeydown onkeypress onkeyup

Note: The onkeyup attribute does not apply to the following Elements: dde6fb694e6711ae5e6f381704c04ae4, 71af07a0e88a1ac1ff73f855702ac153, 0c6dc11e160d3b678d68754cc175188a, 93f0f5c25f18dab9d176bd4f6de5d30e, 100db36a723c770d327fc0aef2ce13b1, d5ba1642137c3f32f4f4493ae923989c, e8e496c15ba93d81f6ea4fe5f55a2244, 0c68fef83818661b6da588c77ca3985e, 3f1c4e4b6b16bbbd69b2ee476dc4f83a, ab52177e825fb870455eeb8df52ef38e.

Differences between HTML 4.01 and HTML5

None.

Syntax

<element onkeyup="script">

Attribute value

Value Description
script Script to run when onkeyup occurs.

onkeyup event occurs when the keyboard key is released

<html>

<head>
<script type="text/javascript">
function upperCase(x)
{
var y=document.getElementById(x).value
document.getElementById(x).value=y.toUpperCase()
}
</script>
</head>

<body>

输入您的姓名: <input type="text" id="fname" onkeyup="upperCase(this.id)" />

</body>
</html>


The above is the detailed content of The event attribute onkeyup triggered when the user (on the keyboard) releases a key in html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn