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;
}
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101