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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sincronized drop-down lists 1

Status
Not open for further replies.

Mandrutza

Programmer
Feb 12, 2002
34
RO
So I have 3 drop-down lists.When an user selects an option from one drop-down list I want that the other two list to display the option with the same index.Must work with all three drop-down lists.
I hope you understood my problem.
Thanks
 
Hi Mandrutza,
it's not so hard to do:

<html>
<head>
<script>
function changeSelected(item) {

document.f1.select1.selectedIndex = item.selectedIndex;

document.f1.select2.selectedIndex = item.selectedIndex;

document.f1.select3.selectedIndex = item.selectedIndex;
}

</script>
</head>
<body>

<form name=f1>
<select name=&quot;select1&quot; onchange=&quot;changeSelected(this);&quot;>
   <option selected> sleep - 0
   <option> go - 1
   <option> eat - 2
   <option> stand - 3
</select>

<br>

<select name=&quot;select2&quot; onchange=&quot;changeSelected(this);&quot;>
   <option selected> trjty - 0
   <option> 76ij - 1
   <option> h568oh - 2
   <option> 34r 65h - 3
</select>

<br>

<select name=&quot;select3&quot; onchange=&quot;changeSelected(this);&quot;>
   <option selected> 0000
   <option> 111
   <option> 222
   <option>3333
</select>
</form>

</body>
</html>

You need only one function to change all 3 drop-down lists at once.

good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top