Page 1 of 1
[SOLVED] Two listboxes - having trouble clearing one when ot
Posted: Mon Sep 13, 2004 5:11 pm
by voltrader
I have two listboxes and would like to clear one when something in the other is selected, and vice versa.
I tried using:
Code: Select all
onChange="e;javascript: formname.productsї].selected=false;"e;
at the end of the SELECT statement, but it doesn't work. I tried onFocus as well.
Any ideas on what's wrong?
Posted: Mon Sep 13, 2004 5:13 pm
by feyd
Code: Select all
formname.elementsї'productsї]'].selectedIndex = 0
maybe...
Posted: Mon Sep 13, 2004 5:18 pm
by voltrader
Hmm, I tried that using both onFocus and onChange to no avail.
Posted: Mon Sep 13, 2004 5:31 pm
by feyd
Code: Select all
<html>
<head>
</head>
<body>
<form name="e;form1"e;>
<input type="e;text"e; name="e;test"e; />
<select name="e;productsї]"e; multiple="e;multiple"e; onchange="e;document.formsї'form1'].elementsї'otherї]'].selectedIndex = -1;"e;>
<option value="e;10"e;>10</option>
<option value="e;20"e;>20</option>
<option value="e;30"e;>30</option>
<option value="e;40"e;>40</option>
<option value="e;50"e;>50</option>
</select>
<select name="e;otherї]"e; multiple="e;multiple"e; onchange="e;document.formsї'form1'].elementsї'productsї]'].selectedIndex = -1;"e;>
<option value="e;60"e;>60</option>
<option value="e;70"e;>70</option>
<option value="e;80"e;>80</option>
<option value="e;90"e;>90</option>
<option value="e;100"e;>100</option>
</select>
</form>
</body>
</html>
sure works here...
Posted: Mon Sep 13, 2004 5:36 pm
by voltrader
Feyd -- thanks again... I needed to enclose the form name in the forms-tag, as you showed above: "forms['search'].