window.onload=function(){
function prepareGallery(){
if(!document.getElementById)return false;
if(!document.getElementsByTagName)return false;
if(!document.getElementById('imagegallery'))return false;
var gallery=document.getElementById("imagegallery");
var links=gallery.getElementsByTagName('a');
for(var i=0;i<links.length;i++){
links[i].onclick=function(){
//showPic(this);
return showPic(this)?false:true;
}
}
}
function showPic(whichpic){
if(!document.getElementById("placeHolder"))return false;
var source=whichpic.getAttribute('href');
var placeholder=document.getElementById("placeHolder");
placeholder.setAttribute('src',source);
if(document.getElementById("description")){
var descriotion=document.getElementById("description");
var text=whichpic.getAttribute('title');
descriotion.firstChild.nodeValue=text;
}
return true;
}
}
</script>
亲爱的们,为什么我的代码实现不了??? 麻烦帮忙看下,谢啦!!!(编程艺术(第二版)中的第一段代码练习)