Home > Article > Web Front-end > Detailed introduction to the use of this in html tags
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>
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!