Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdowns 1

Status
Not open for further replies.

snt

MIS
Jun 19, 2000
104
US
I have 7 dropdown menus. The user will need to select an option from one of them. Is there a way to make it so if a user selects from one of them, the others will return to the first option that has no value so the user can not select from more then one menu?
i.e.
<select name=1>
<option value=&quot;&quot;>Select an option...
<option value=&quot;1&quot;>1
<option value=&quot;2&quot;>1
<option value=&quot;3&quot;>3
etc...

I hope I explained it ok.
Thanks
SNT
 
<form>
<select onchange=&quot;clearAll(this)&quot;>
<option>haha</option>
<option>choice 2</option>
</select>
<select onchange=&quot;clearAll(this)&quot;>
<option>This is select box 2.</option>
<option>bleh</option>
</select>
</form>
<script type=&quot;text/javascript&quot;>
<!--
function clearAll(myInput) {
for (var i=0; i < myInput.form.length; i++) {
if (myInput.form.type.indexOf(&quot;select&quot;) != -1)
if (myInput.form != myInput)
myInput.form.options[0].selected=true;
}
}
// -->
</script>
bluebrain.gif
blueuniment.gif
 
ok, i'm sure i'm missing something.i am pretty new at this.

am I right to assume that the text you have in italics needs to be changed? if so, what does it need to be change to?

 
Oops...

The italics is because I didn't enclose the script in [ignore]
Code:
[/ignore] tags. This is more correct:
[code]

<form>
<select onchange=&quot;clearAll(this)&quot;>
 <option>haha</option>
 <option>choice 2</option>
</select>
<select onchange=&quot;clearAll(this)&quot;>
 <option>This is select box 2.</option>
 <option>bleh</option>
</select>
</form>
<script type=&quot;text/javascript&quot;>
<!--
function clearAll(myInput) {
 for (var i=0; i < myInput.form.length; i++) {
  if (myInput.form[i].type.indexOf(&quot;select&quot;) != -1)
   if (myInput.form[i] != myInput)
    myInput.form[i].options[0].selected=true;
 }
}
// -->
</script>
bluebrain.gif
blueuniment.gif
 
You just got yourself another star.

Thank you.

SNT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top