Javascript examples for DOM Event:onclick
Responding to a user clicking "ok" on a confirm alert dialog
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {//from w w w . j ava 2 s .co m var r = confirm("Press a button!"); if (r == true) { console.log("You pressed OK!"); } else { console.log("You pressed Cancel!"); } }); </script> </head> <body> </body> </html>