Looping through all Form Elements

M

Mel

I need to loop through all form elements such as text, radios, check
boxes and the like and to save their state in a file.

does anyone have JS code to do this ? It can help a bunch

thanks
 
G

Georgi Naumov

You can easily iterate the elements colection.
"elements" is a collection, in source order, of all controls in a given
form. input type=image objects are excluded from the collection. For
example:
function handleFormControls(aFormObj){
if(aFormObj.tagName != "FORM")
return;
for(i=0;i<aFormObj.elements.length;i++)
{
var currEl=aFormObj.elements;
/*******************************
Work with current control
********************************/
}
}
But you cannot save nothing in file with JavaScript. Only in Internet
Explorer this is possible with AxtiveX control.
Mel напиÑа:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top