function showPic(whichpic) { if (!document.getElementById("placeholder")) return true;//1.比如这个:如果浏览器不支持。也没别的函数调用这个函数。那 return false 传给谁?谁会接收这个return? var source = whichpic.getAttribute("href"); var placeholder = document.getElementById("placeholder"); placeholder.setAttribute("src",source); if (!document.getElementById("description")) return false; if (whichpic.getAttribute("title")) { var text = whichpic.getAttribute("title"); } else { var text = ""; } var description = document.getElementById("description"); if (description.firstChild.nodeType == 3) { description.firstChild.nodeValue = text; } return false;} for ( var i=0; i < links.length; i++) { links[i].onclick = function() { return showPic(this); } links[i].onkeypress = links[i].onclick; }}这些代码是js dom编程艺术里的。
添加回答
举报
0/150
提交
取消