Tryit Editor v1.4

<html> <head> <script type="text/javascript"> function disp_confirm() { var r=confirm("Press a button"); if (r==true) { document.write("You pressed OK!"); } else { document.write("You pressed Cancel!"); } } </script> </head> <body> <input type="button" onclick="disp_confirm()" value="Display a confirm box" /> </body> </html> | Your Result:
Edit the code above and click to see the result. | W3Schools.com - Try it yourself