I need to get some children elements and loop over them using inline javascript for a onmouseover event. When I try to use this.getElementsByName I'm getting an error that the object does not support this property. I was under the impression that getElementsByName work for element objects which I thought 'this' would be considered. Anyone have any other ideas on how I can achieve this?
A:
getElementsByName only exists on the document level.
Also what kind of elements are you trying to access? Because the name attribute only exists for links (a elements) and form elements (input, select, etc.).
If you have several elements which you want to give the same "name", you may consider giving them a class instead, however you'd most likely need to loop over all elements and search for the ones with the right class, because getElementsByClass is only supported by a few browsers.
RoToRa
2010-05-04 15:16:50