alert(document.forms[0].getElementsByTagName("input")[0].name);
Will display the the name of the the first input field type in the first
form on the page.
var inputTags = document.forms[1].getElementsByTagName("input");
for (i = 0; i < inputTags.length; i++);
alert(inputTags[i].name);
Will display all the names of the input fields one at a time form the second
form on the page.
This is cross browser compliant.
document.all is only valid in the IE browser DOM
--
Tim Coy
Timco Electronics Pty Ltd
[EMAIL PROTECTED]
> Hi,
>
> My JSP page has some javascript that need to references the html:form by
> name but how elegently get the form name and input field name to achieve the
> following without harcoding?
>
> Document.forms['my_form'].elements['my_element_1']
>
> Thanks
>
> Stu
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]