What is the correct way to find a form? I have:
But this was written some time back (over a year I believe), so was wondering if I needed to correct it.Code:var formObj = eval('document.forms.' + formName)
Thanks,
Michael
Printable View
What is the correct way to find a form? I have:
But this was written some time back (over a year I believe), so was wondering if I needed to correct it.Code:var formObj = eval('document.forms.' + formName)
Thanks,
Michael
forms is part of the DOM. So using...
You'll also get away with using document.getElementById('form1') if the form has an id attribute and document.getElementsByName('form1') if name attributeCode:syntax : document.forms(objectID/Name)...
document.forms('form1')...
document.forms(1)...
Shouldn't they be square brackets, or can you use standard ones?
it works with both but I [] is in the documentation
Oh right.
I changed to:
and it works great :)Code:var formObj = eval(document.forms[formName]);
Thanks,
Michael