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

Javascript loop through dynamically created select boxes

Status
Not open for further replies.

kev510

Programmer
Jul 12, 2006
61
Hello everyone,

I am trying to create a javascript function to show values of select boxes (drop down menu) that are dynamically created with the LOOP function using vbScript. It creates a select box for each of the lines of the table I have on my webpage. So if there ends up being 10 rows in the table, vbScript will create 10 select boxes.

The ID of these select boxes are also dynamically named, such as SelectBox1, SelectBox2, SelectBox3, etc...

The javascript function should loop through to obtain the value of those select boxes and display them using alert() function. So far, here's what I've come up with -

//vCount is the number of select boxes I have in the webpage
var vCount = document.saveform.vCount.value
var i=0
for (i=0; i<=vCount; i++)
{
alert(document.saveform.SortOrder+i.value)
}

Thank you for any help that you can provide!
Kevin
 
you can have the vbscript routine that creates the select items, accumulate the value of "count" in a variable and the java script can use it to alert it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top