getElementByName() is not supported on all browsers.
The DOM functions getElementsByTagName and getAttribute are more supported.
Try a function like which uses those two to get the same result:
/**
* Retrive an HTML Element Collection By name
* @return Array HTML Elements
* @param Object Parent Element
* @param String name
* @param String Tag name to limit search to
*/
function getElementsByName(parent, name, tag) {
var els = new Array();
var allChildren = parent.getElementsByTagName(tag || '*');
for (var i = 0; i < allChildren.length; i++) {
var child = allChildren[i];
if (child.getAttribute('name') == name) {
els.push(child);
}
}
return els;
}
Last edited by digital-ether; Jan 13th, 2007 at 12:41 am.
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
Offline 1,250 posts
since Sep 2005