-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I think this is sad, but... I'm at a loss...
I am trying to do an if statement in a function and it's just not working.
I have a test.zul file and a test.zs file. in the zul file, I have this... <zscript src="test.zs" />
Ultimately what I want, is to have some variables that i want to change depending on what's selected in a listbox.
Then what's done in the function will vary depending on what the variable is.
But the if statement just isn't working.
some example code...
<variables type="1" /> <zscript src="test.zs" /> <listbox id="LBtest" mold="select" rows="1"> <listitem label="first" value="1"/> <listitem label="second" value="2"/> <listitem label="third" value="3"/> <attribute name="onSelect"> self.setVariable("type", LBtest.getSelectedItem().getValue(), true); </attribute> </listbox> <button label="submit" onClick="submit()"/>
void submit() { if (type == "1"){ alert("1"); } if (type == "2"){ alert("2"); } if (type == "3"){ alert("3"); } if (type != null){ alert("null... type == "+type); } }
self.setVariable("varA", 1, true); if (Qtype == varA){ alert("1"); }
I found a problem in your code
if (type == "1")
Asked: 2008-12-20 00:27:59 +0800
Seen: 725 times
Last updated: Dec 22 '08