<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Snapshots</title> </head> <script type="text/javascript"> function showPic(whichpic){ var source = whichpic.getAttribute("href"); var placeholder = docunment.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]; } window.onload = countBodyChildren; </script> <body> <h1>Snapshots</h1> <ul> <li><a href="img/1.jpg" title="display" onclick="showPic(this),return false," >fireworks</a></li> <li><a href="img/2.jpg" title="coffee" onclick="showPic(this),return false," >Coffee</a></li> <li><a href="img/3.jpg" title="rose" onclick="showPic(this),return false," >Rose</a></li> <li><a href="img/1.jpg" title="clock" onclick="showPic(this),return false," >Big Ben</a></li> </ul> <img id="placeholder" src="img/2.jpg" style="width: 400px;height: 300px;" alt="my image gallery"> <p id="description">Choose an image.</p> </body> </html>
当我点击链接的时候,会跳转到图片页面 而不是在初始页面下面的图片栏显示对应图片 为什么??