//非IE浏览器正常显示数目,IE显示数目为0
完善修改后:
var LoadImg = document.getElementsByName("ImgDiv");
alert(LoadImg.length);
完善修改后:
if (!+[1, ]) //IE
{
var LoadImg = document.getElementsByTagName('div');
var n=0;
for (var i = 0,m=0; i < LoadImg.length; i++) {
if (LoadImg[i].name == "ImgDiv")
{
n++;
}
}
alert(n);
}
else //非IE
{
var LoadImg = document.getElementsByName("ImgDiv");
alert(LoadImg.length);
}