Javascript examples for DOM:Event
Click the button to trigger a function that will output "Hello World" in a p element with id="demo".
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function myFunction() {//from w ww. j a va 2 s . c o m document.getElementById("demo").innerHTML = "Hello World"; } </script> </head> <body> <button onclick="myFunction()">Click me</button> <p id="demo"></p> </body> </html>