javascript图片库

onclick事件中return下标出现红线

img


.html

Snapshots

  • 苹果界面
  • 夕阳西下
  • 小小蛋糕
  • my image gallery

    .js
    function showPic(whichpic){
    var source=whichpic.getAttribute("href");
    var placeholder=document.getElementById("placeholder");
    placeholder.setAttribute("src",source);
    var text=whichpic.getAttribute("title");
    var description=document.getElementById("description");
    description.firstChild.nodeValue=text;
    }
    function countBodyChildren(){
    var body_element=document.getElementsByTagName("body")[0];
    alert(body_element.childNodes.length);
    window.onload=countBodyChildren;
    }

    onclick事件return false本来不应该报错却一直出现红线

    我想要达到的结果 点击前三个图片链接显示的图片会直接替换第四个图片并显示

img


a的href设置为#,图片地址放到点击函数作为参数传进去
return 可以不用要