We are working on a new project and we needed to create the array of form elements in Javascript. After googling for some time we found out that we can access all the form elements in document.formName.elements
Following code loops through the form and creates an associative array of form elements:
function getFormElements()
{
frmElmts = new Array();
for(i=0; i<document.formName.elements.length; i++)
{
frmElmts[document.formName.elements[i].name] = document.formName.elements[i].value;
}
}
