为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

甫里 2016-03-23 18:01:13
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
查看完整描述

1 回答

已采纳
?
display_none

TA贡献52条经验 获得超13个赞


if(description.firstChild.nodeValue==3){     这行的nodeValue应该是nodeType

查看完整回答
2 反对 回复 2016-03-24
  • 1 回答
  • 0 关注
  • 1480 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信