Forum Moderators: open
I have 2 drop down boxes. The both contain the same date information. What I want is that if the user changes the date in the first drop down box, the same date should be selected in the second drop down box. If figured out that I get the selected index with:
"sel=document.forms[0].date1.options[document.forms[0].Date1.selectedIndex].index".
But how can I give this value to the second drop down box? Is there a method like:
"return document.forms[0].Date2.options[document.forms[0].Date2.setIndex].index = sel"
or something similar? Or is it only possible that I sent both arrays (date1 and date2) to my Javascript when I run it? How should I do this in this case? (Sorry, I'm rather new to Javascript :))
Thanks!
Is it something like this you are looking for?
<html>
<head>
</head>
<body>
<select id=sel1 onchange="document.getElementById('sel2').value=this.value">
<option>Please Select</option>
<option value="Date 1">Date 1</option>
<option value="Date 2">Date 2</option>
</select><br>
<select id=sel2>
<option>Please Select</option>
<option value="Date 1">Date 1</option>
<option value="Date 2">Date 2</option>
</select>
</body>
</html>
HTH,
-George