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

Use javascript to read a form's listbox index in for loop

Status
Not open for further replies.

farazmit

Programmer
Jan 3, 2005
14
0
0
US
Hi
I want to use javascript to read form's listbox index in a for loop boundry.
The problem is shown below:

<select name="List2" value = "<please select an occupation>" onChange="this.form.ValueIn2.value=this.options[this.selectedIndex].value">
"<please selecrt an occupation>" <option>

<script type="text/javascript">
/////////INSTEAD OF 6 I WOULD LIKE TO READ A LISTBOX
///////// SELECTEDINDEX NUMBER
///////// FROM ANOTHER SELECTBOX WITHIN THE SAME FORM
///////// WHAT SHOULD I TYPE IN CONSIDERING THE FACT
//////// THAT I AM IN JAVASCEIPT. I TRIED to put
//////// form1.List1.options[selectedIndex] and also
//////// documen.write('form1.List1.options[selectedIndex]
//////// but none of them worked
for (loop7=0;loop7 < 6 ;loop7++){
document.write('<option>');
}
</script>
</select>
</form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top