Jump to content

pop up window


zachary

Recommended Posts

How do i make this pop up without having to click the button?

<html><head><script type="text/javascript">function disp_confirm(){var name=confirm("Press a button")if (name==true){document.write("You pressed the OK button!")}else{document.write("You pressed the Cancel button!")}}</script></head><body><form><input type="button" onclick="disp_confirm()" value="Display a confirm box"></form></body></html>
Link to comment
Share on other sites

use a different event handler.you could use <body onload="disp_confirm()" > - Would be displayed when page is loaded<body onkeypress="disp_confirm()" > - Would be displayed when keyboard is pressedThere are many event handlers, see here: http://www.w3schools.com/dhtml/dhtml_events.asp

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...