HTML DOM events
Translation results:
HTML DOM allows JavaScript to react to HTML events.
HTML DOM eventssyntax
JavaScript can be executed when an event occurs, such as when a user clicks on an HTML element.
To execute code when the user clicks on an element, add JavaScript code to the HTML event attribute:
onclick=JavaScript
Example of HTML event:
When the user clicks Mouse time
When the web page has loaded
When the image has loaded
When the mouse moves over the element
When the input field is changed
When the HTML form is submitted
When the user triggers a keypress
HTML DOM eventsexample
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <h1 onclick="this.innerHTML='Ooops!'">点击文本!</h1> </body> </html>
Run instance »
Click the "Run instance" button to view the online instance
Popular Recommendations
- CakePHP View Events
- Litlyx - Introducing Funnel Events
- Day Handling Events in React
- Monopoly Go events and tournaments taking place today
- Understanding Events in Node.js with Simple Code Examples - Node.js Tutorial - Part 6
- Bitcoin (BTC) Price Struggles Amidst Key Events, Presto Research Analysts Call it 'Significantly Undervalued”