Goril Posted October 20, 2006 Share Posted October 20, 2006 Hi EVERYBODY !! Hope you all are having fun. As i was browzing the site i saw this: <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> Or LINKI would like someone to tell me how i can put links instead of the text like :Are you sure u want to come in ?OK = makes the persone continue to laod siteCANCEL = makes them go to a certain siteTHX IF YOU CAN HELP ME Link to comment Share on other sites More sharing options...
jesh Posted October 20, 2006 Share Posted October 20, 2006 You could use location.href to send the visitor to a different site if s/he clicks cancel rather than writing "You pressed the Cancel button!". location.href = "http://www.w3schools.com"; Link to comment Share on other sites More sharing options...
Goril Posted October 20, 2006 Author Share Posted October 20, 2006 edit: i got another prob read ahead but i still mean this : THX SO MUCH !! that just what i needed ty Link to comment Share on other sites More sharing options...
aspnetguy Posted October 20, 2006 Share Posted October 20, 2006 var name=confirm("Are you sure you want to come in?","Enter my site?") Link to comment Share on other sites More sharing options...
Goril Posted October 20, 2006 Author Share Posted October 20, 2006 Got one more prob: this is what i got : <html><head><script type="text/javascript">function disp_confirm(){var name=confirm("Press a button")if (name==true){location.href = "http://www.triches.forumpro.com";}else{location.href = "http://www.triches.fr";}}</script></head></html> but i need it to unload automaticly: what do i put in the body to make this work ?ty Link to comment Share on other sites More sharing options...
Goril Posted October 20, 2006 Author Share Posted October 20, 2006 PLEASE HELP !! Link to comment Share on other sites More sharing options...
jesh Posted October 20, 2006 Share Posted October 20, 2006 <body onload="disp_confirm();"> This will pop up the confirmation when the page first loads. Link to comment Share on other sites More sharing options...
Goril Posted October 21, 2006 Author Share Posted October 21, 2006 Thx very much !! POST CLOSED !! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now