Common HTML events

来源:互联网 发布:2015网络歌曲排行榜 编辑:程序博客网 时间:2024/06/06 02:21

Alert

<script>window.alert("Hello World!");</script>


Write

<script>document.script(5 + 6);</script>
But if using document.write() after an HTML document is fully loaded, will delete all existing HTML.
<!DOCTYPE html><html><body><h1>My First Web Page</h1><p>My first paragraph.</p><button onclick="document.write(5 + 6)">Try it</button></body></html>


console.log() used to display data

<script>console.log(5 + 6)</script>

EventDescriptiononchangeAn HTML element has been changedonclickThe user clicks an HTML elementonmouseoverThe user moves the mouse over an HTML elementonmouseoutThe user moves the mouse away from an HTML elementonkeydownThe user pushes a keyboard keyonloadThe browser has finished loading the page

Reference:http://www.w3schools.com/jsref/dom_obj_event.asp



0 0
原创粉丝点击