日期:2014-05-16  浏览次数:20339 次

window.onload=count;没反应
function showPic(whichpic){
var source=whichpic.getAttribute("href");  
var placeholder=document.getElementById("placeholder"); 
placeholder.setAttribute("src",source);
}
function count()
{
var body=document.getElementByTagName("body")[0];
alert(body.childNodes.length);
alert("hi");
}
window.onload=count;用ie9,firefox。safari都不行,代码错了吗??



------解决方案--------------------
document.getElementsByTagName("body")[0]啦