Get Element By Tag and Name attribute (getElementsByName sort of)
Cross browser function to get element(s) by "name" attribute.
/** getElementsByTagAndName: to avoid missing getElementsByName in IE */
function getElementsByTagAndName(tag, name) {
var elem = document.getElementsByTagName(tag);
var arr = new Array();
for(i = 0, iarr = 0; i < elem.length; i++) {
att = elem[i].getAttribute("name");
if(att == name) {
arr[iarr] = elem[i];
iarr++;
}
}
return arr;
}
Thanks for the script. Very useful.
ReplyDeleteHey, I saw your profile on dancePartner.com(my nick there is larabonita )if u're interested write me at 4katerina@gmail.com :)
ReplyDelete