Javascript examples for DOM:Quiz
When the button is clicked, trigger myFunction() with an event.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Click Me</button> <p id="demo"></p> <script> function myFunction() {// ww w . java 2s . c o m document.getElementById("demo").innerHTML = "Hello World"; } </script> </body> </html>