Click to See Complete Forum and Search --> : Need Help: Javascript confirm on pulldown menu navigation...


sihnstarr
08-08-2003, 12:01 PM
Greetings...

I am having a problem with a web page continuing to load after the cancel is clicked in a javascript:confirm box.

here is my code:

function pulldown_menu3()
{
var url = document.pulldown3.selectname3.options[document.pulldown3.selectname3.selectedIndex].value
window.location.href = url
if (document.pulldown3.selectname3.selectedIndex <= 11)
{
confirm('You are now exiting .com and entering a new Web site. Would you like to continue?');
}
else{}

}

When the user selects a certain link in the pulldown, it is supposed to confirm if they want to leave the website or not. as i have been testing it, when i click 'Cancel' it keeps going to the website anyway.

Does anyone have any ideas?

thank you,

~s.

Exuro
08-08-2003, 12:50 PM
I think you want it to be something more like this:


function pulldown_menu3()
{
&nbsp;&nbsp;var url = document.pulldown3.selectname3.options[document.pulldown3.selectname3.selectedIndex].value
&nbsp;&nbsp;if (document.pulldown3.selectname3.selectedIndex <= 11) {
&nbsp;&nbsp;&nbsp;&nbsp;if (confirm('You are now exiting .com and entering a new Web site. Would you like to continue?'))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{window.location.href = url}
&nbsp;&nbsp;}
}