Home > Web Front-end > HTML Tutorial > Detailed introduction to the use of this in html tags

Detailed introduction to the use of this in html tags

高洛峰
Release: 2017-03-06 15:44:53
Original
2144 people have browsed it

Many friends are unfamiliar with this in the html tag. The example in this article is that after inputting characters into the text box through the keyboard, the pressed characters will be displayed when the button is lifted. For example:

The code is as follows:

<html> 
<head> 
<script type="text/javascript"> 
function showHint(str){ 
alert(str) ; 
} 
</script> 
</head> 
<body> 
<input type="text" onkeyup="showHint(this.value)"/> <!--此处,在html标签中的this代表的是此标签--> 
</body> 
</html>
Copy after login


The running result is: after inputting characters into the text box through the keyboard, when the key is lifted (that is, when the keyup event occurs), the pressed character is displayed.

For more detailed introduction to the use of this in html tags, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template