[thelist] javascript - how to refer to (x)html elements
Kristof Neirynck
k.neirynck at belgacom.net
Wed Nov 12 12:12:35 CST 2003
>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>>i want to use:
>>
>> document.formId.inputId.value
>> (eg. <form id="example"> <input id="example" />)
>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>
> don't. there's no reason whatsoever to not use dom0 access methods. use
> the forms and elements collections for their intended purpose.
>
What Jeff is trying to explain is this:
var formNr = 0;
var elementName = 'theName';
var element = document.forms[formNr].elements[elementName];
This way you don't need id's.
It works in nn4+, ie4+ and any other browser that has some sort of
javascript support.
--
Kristof
More information about the thelist
mailing list