Javascript examples for DOM HTML Element:Input Button
Add button click event handler
<html> <head></head> <body> <h1 id="myid"> what can javascript Do?</h1> <p id="demo">Javascript can change html content.</p> <button type="button" onclick="myFunction()"> Click Me!</button> <script type="text/javascript"> function myFunction() {/*from ww w.ja va 2 s .co m*/ document.getElementById('demo').innerHTML = 'hello javascript'; } </script> </body> </html>