tbroas
07-20-2006, 12:46 PM
I have a question about traversing (or indexing) the elements of a form. From searching around, I know that I can access the elements of a form by using something like:
document.forms[0].elements[number]
I have a form where some of the elements are created dynamically, so I won't always know exactly how many elements the form will have. Is there something that I can use to determine the number of elements that exist? I'd like to use a for loop or something:
for (var i=0; i < document.form[0].element.size? < i++)
{
.
.
.
}
I put in document.form[0].element.size as an example, is there something in javascript like this that tells me the number of elements in the form? Thanks in advance for the advice
document.forms[0].elements[number]
I have a form where some of the elements are created dynamically, so I won't always know exactly how many elements the form will have. Is there something that I can use to determine the number of elements that exist? I'd like to use a for loop or something:
for (var i=0; i < document.form[0].element.size? < i++)
{
.
.
.
}
I put in document.form[0].element.size as an example, is there something in javascript like this that tells me the number of elements in the form? Thanks in advance for the advice