PDA

View Full Version : javascript if statement.


Darth Evad
12-15-2002, 06:44 PM
This doesn't work properly. I can get one or the other to function by fiddling with the if statements. With a quick look can you tell me how to get both and more to work.
Please and Thanks. http://forums.massassi.net/html/smile.gif

//house tab

function mmLoadMenus() {
if (window.mm_menu_0015145500_0) return;
window.mm_menu_0015145500_0 = new Menu("root",107,18,"Arial, Helvetica, sans-serif",12,"#ffffff","#000000","#000066","#e1e2ff","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);
mm_menu_0015145500_0.addMenuItem("TOWNHOME","location='townhomes.php'");
mm_menu_0015145500_0.addMenuItem("SEMI-DETACHED","location='semidetached.php'");
mm_menu_0015145500_0.addMenuItem("SINGLES","location='singles.php'");
mm_menu_0015145500_0.hideOnMouseOut=true;
mm_menu_0015145500_0.menuBorder=1;
mm_menu_0015145500_0.menuLiteBgColor='#e1e2ff';
mm_menu_0015145500_0.menuBorderBgColor='#000000';
mm_menu_0015145500_0.bgColor='#555555';

mm_menu_0015145500_0.writeMenus();
}

//appartment tab

function mmLoadMenus() {
if (window.mm_menu_0015134800_0) return;
window.mm_menu_0015134800_0 = new Menu("root",80,18,"Arial, Helvetica, sans-serif",12,"#ffffff","#000000","#000066","#e1e2ff","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);
mm_menu_0015134800_0.addMenuItem("1 BEDROOM","window.open('appartments.php', 'right');");
mm_menu_0015134800_0.addMenuItem("2 BEDROOM","window.open('appartments.php', 'right');");
mm_menu_0015134800_0.addMenuItem("3 BEDROOM","window.open('appartments.php', 'right');");
mm_menu_0015134800_0.addMenuItem("4 BEDROOM","window.open('appartments.php', 'right');");
mm_menu_0015134800_0.hideOnMouseOut=true;
mm_menu_0015134800_0.menuBorder=1;
mm_menu_0015134800_0.menuLiteBgColor='#e1e2ff';
mm_menu_0015134800_0.menuBorderBgColor='#000000';
mm_menu_0015134800_0.bgColor='#555555';

mm_menu_0015134800_0.writeMenus();
}



------------------
It was in Bobcaygeon, when I saw the constellations reveal themselves one star at a time.

LordVirus
12-16-2002, 08:31 AM
The fact that you have two functions with the same name could be a problem.

------------------
His pot is blacker than his kettle!

Phoenix Swords (http://www.phoenixswords.com)

Darth Evad
12-16-2002, 10:14 AM
I call on the same function and have my if's look for a different variable.
Is my logic and or syntax wrong? Maybe I need an OR or AND?

------------------
It was in Bobcaygeon, when I saw the constellations reveal themselves one star at a time.

Gamma_Ray54
12-16-2002, 11:06 AM
I'm not quite sure what you're going for, but you can't have two functions with the same name. You need to put both blocks of code within one function definition, and use block if statements to execute on set or the other of code, depending on the variables.

Darth Evad
12-16-2002, 11:20 AM
OK. That makes sense. I'll give that a try. Thanks.

------------------
It was in Bobcaygeon, when I saw the constellations reveal themselves one star at a time.