请问下这段JS有什么错误?为什么无法运行呢

function prepareGallery(){

if(!document.getElementsByTagName) return false;

if(!document.getElementById) return false;

if(!document.getElementById("imagegallery")) return false;

var gallery=document.getElementById("imagegallery");

var links=gallery.getElementsByTagName("a");

for(var i=0;i<links.lengrh;i++){

links[i].onclick=function(){

return showPic(this)?false:ture;}

}

}

function showPic(whichpic){

if(!document.getElementById("placeholder")) return false;

var source = whichpic.getAttribute("href");

var placeholder = document.getElementById("placeholder");

if(placeholder.nodeName!='IMG') return false;

placeholder.setAttribute("src",source);

if(document.getElementById("description")){

var text=whichpic.getAttribute("title");

var description=document.getElementById("description");

if(description.firstChild.nodeValue==3){

description.firstChild.nodeValue=text;

 }

}

return true;

}// JavaScript Document



甫里
浏览 1517回答 1
1回答

display_none

if(description.firstChild.nodeValue==3){     这行的nodeValue应该是nodeType
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript