var getElementsByName = function (tag, name){
var returns = document.getElementsByName(name);
if (returns.length > 0 ) return returns;
returns = new Array();
var e = document.getElementsByTagName(tag);
for ( var i = 0 ; i < e.length; i ++ ){
if (e[i].getAttribute( " name " ) == name){
returns[returns.length] = e[i];
}
}
return returns;
}
alert(getElementsByName( " div " , " odiv " ).length); // IE:4 FF:4
document.getElementsByName() 兼容
最新推荐文章于 2024-09-07 03:19:38 发布