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

looping thru to set drop down values

Status
Not open for further replies.

tester321

Programmer
Mar 13, 2007
150
CA
Hi I was wondering if it was possible to loop thru to set the values of drop downs, like so (can't seem to get it working:

for (i=0;i<4;i++){
NAME.options[NAME.selectedIndex].value=5;
}

Thanks
 
Hi cLFlaVA, yes i'm trying to set the value not the control, not sure why its not working, i have the JS at the end of the page. Its a .Net drop down control that i'm trying to set:
form1.DropDownSpecialty.options[form1.DropDownSpecialty.selectedIndex].value=5;

I wonder if it won't work because of the .net control? THanks, i'll keep figuring this one out. I have coded for it to work using server side code, but i'm still puzzled why the script won't intantiate over the control
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top