Click to See Complete Forum and Search --> : multi if statements troubleshoot?


freaksarise
05-08-2003, 11:17 PM
Hello everyone. I have pulldown (list form element). OnChange I am having it run this function. Based upon the option selected or VALUE I am having do one of 2 things.

The code below works perfect. However when I remove the comments the multiple statements for the first condition do not react as I would predict. It appears to treat the alert as a straight command and not as a result of the condition. How do I make multiple actions occur off of one condition. See code below:


THIS WORKS:

function rw_test() {
if (document.form2.rwpulldown.value=="x.htm")
MM_openBrWindow('x.htm','','width=250,height=200');
//alert("x yes");
//var targetrw = "blank";


if (document.form2.rwpulldown.value=="y.htm")
alert("y yes");
}


THIS DOES NOT WORK (note I am trying to have all 3 statements occur from the first IF only)

function rw_test() {
if (document.form2.rwpulldown.value=="x.htm")
MM_openBrWindow('x.htm','','width=250,height=200');
alert("x yes");
var targetrw = "blank";


if (document.form2.rwpulldown.value=="y.htm")
alert("y yes");
}

Thank you all so much for your help!
FA

freaksarise
05-08-2003, 11:40 PM
I got it!!
I had to place the group in a command block like this:

function rw_test() {
if (document.form2.rwpulldown.value=="x.htm") {
MM_openBrWindow('x.htm','','width=250,height=200');
alert("x yes");
var targetrw = "blank";}


if (document.form2.rwpulldown.value=="y.htm")
alert("y yes");
}

Thanks, I know you would have all supplied amazingingly friendly assistance. I look forward to the next questions as I grow and learn thanks to you all.
FA