HighDots Forums  

Looping over multiple SELECT boxes

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Looping over multiple SELECT boxes in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chris
 
Posts: n/a

Default Looping over multiple SELECT boxes - 07-23-2004 , 07:10 PM






I need to loop over multiple SELECT boxes. At the moment, I have 32
SELECT BOXES, all in the same form, and they are named
Select0...Select31. Is there any way to
1. Get the number of SELECT boxes in the form
2. Loop over the select boxes with a for loop (ie form.Select[x])

Thanks for any help with either of these.

Reply With Quote
  #2  
Old   
Chris
 
Posts: n/a

Default Re: Looping over multiple SELECT boxes - 07-24-2004 , 01:47 PM






reevesc (AT) gmail (DOT) com (Chris) wrote in message news:<5623e982.0407231610.53fe8477 (AT) posting (DOT) google.com>...
Quote:
I need to loop over multiple SELECT boxes. At the moment, I have 32
SELECT BOXES, all in the same form, and they are named
Select0...Select31. Is there any way to
1. Get the number of SELECT boxes in the form
2. Loop over the select boxes with a for loop (ie form.Select[x])

Thanks for any help with either of these.


Nevermind, I found the solution
to those interested, you can use eval("form.select" + x + ".value");
where x increments for each select box.


Reply With Quote
  #3  
Old   
Randy Webb
 
Posts: n/a

Default Re: Looping over multiple SELECT boxes - 07-24-2004 , 03:30 PM



Chris wrote:
Quote:
reevesc (AT) gmail (DOT) com (Chris) wrote in message news:<5623e982.0407231610.53fe8477 (AT) posting (DOT) google.com>...

I need to loop over multiple SELECT boxes. At the moment, I have 32
SELECT BOXES, all in the same form, and they are named
Select0...Select31. Is there any way to
1. Get the number of SELECT boxes in the form
2. Loop over the select boxes with a for loop (ie form.Select[x])

Thanks for any help with either of these.




Nevermind, I found the solution
to those interested, you can use eval("form.select" + x + ".value");
where x increments for each select box.
document.forms['formName'].elements['select'+ x].value;

no need for eval.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.