function showpic(whichpic){
var source=whichpic.getAttribute("href");
var placeholder=document.getElementById("placeholder");
placeholder.setAttribute("src",source);
}
function countbodychildren(){
var body_element=document.getElementByTagName("body")[0];
alert(body_element.childNodes.length);
}window.onload = countbodychildren;
这个小程序,在html中head引用,为什么没有弹出alert对话框呢,大家帮我看看,找了半天没找到问题出在哪里,谢谢了~!
var source=whichpic.getAttribute("href");
var placeholder=document.getElementById("placeholder");
placeholder.setAttribute("src",source);
}
function countbodychildren(){
var body_element=document.getElementByTagName("body")[0];
alert(body_element.childNodes.length);
}window.onload = countbodychildren;
这个小程序,在html中head引用,为什么没有弹出alert对话框呢,大家帮我看看,找了半天没找到问题出在哪里,谢谢了~!
getElementsByTagName
getElementById
getElementsByName
getElementsByTagName
getElementsByName 得到数组对象
getElementsByTagName 得到数组对象。
getElementsByName
getElementsByTagName