Click to See Complete Forum and Search --> : javascript pop-up box


Htmlwiz
12-31-2006, 07:08 PM
How do i set up a pop-up box so it pops up when the page loads and then when you click ok it go to another pop up and when you press cancel it just stops the flow of popups?

bradgrafelman
01-01-2007, 04:34 AM
<script type="text/javascript">
function popUp() {
var message1 = "First pop up box... OK?";
var message2 = "Here's the second...";
if(confirm(message1)) {
if(confirm(message2)) {
// whatever
}
}
}
window.onload = popUp;
</script>

Htmlwiz
01-01-2007, 04:41 AM
I just have to change the var message then or is there something else?

bradgrafelman
01-01-2007, 05:11 AM
Well, yeah, just change the messages to say whatever you want... replace '// whatever' to do whatever you'd like it to do... etc.

Htmlwiz
01-01-2007, 05:21 AM
Im trying to set something up like this... I have everything else I just can't get this segment of the code to work

<html>
<script type="text/javascript">
function popUp() {
var message1 = "Browser could not start page.";
var message2 = "Browser is now refreshing. Click OK";
var message3 = "Browser could not be refreshed try again?";
var message4 = "Page has loaded succesfully. Click OK to continue on to page";
if(confirm(message1)) {
if(confirm(message2)) {
if(confirm(message3))
if(confirm(message4))
// whatever
}
}
}
window.onload = popUp;
</script>
</html>

bradgrafelman
01-01-2007, 06:08 AM
Y'know, I'd love to help, but every time I read your signature my potential replies get laced with bitter comments, so I believe I'll be staying out of this thread from now on. Sorry.

rincewind456
01-01-2007, 11:28 AM
If you used some method of indicating which curly brace end belongs to which curly brace start then you would find all programming much easier.

This works for me
<html>
<script type="text/javascript">
function popUp() {
var message1 = "Browser could not start page.";
var message2 = "Browser is now refreshing. Click OK";
var message3 = "Browser could not be refreshed try again?";
var message4 = "Page has loaded succesfully. Click OK to continue on to page";
if(confirm(message1)) {
if(confirm(message2)) {
if(confirm(message3)){
if(confirm(message4)){
// whatever
}<!--endif1-->
}<!--endif2-->
}<!--endif3-->
}<!--endif4-->
}<!--endfunc-->
window.onload = popUp;
</script>
</html>

Htmlwiz
01-01-2007, 03:25 PM
ok thanks and as to Bradgrafelman your not gonna help me because of what i belive in?