日期:2014-05-16  浏览次数:20361 次

新人问题,为什么在onclick="return false"中加入函数,它就会跳转,不加就不跳
本帖最后由 u011758815 于 2013-09-10 15:19:53 编辑
新人问题,按照JavaScript DOM编程艺术的图片原页面浏览打的代码,可是总是跳转,为什么在onclick="return false"中加入showpic(whichpic)函数,它就会跳转,不加就不跳,而且把函数放在return false的后面也不会跳?代码如下:
<html>
<head>
<meta http-equive="content-type" content="text/html; charset=utf-8"/>
<title>Just a test</title>
<script type="text/javascript">
function showpic(whichpic)
{
   var source=whichpic.getAttribute("href");
   var placeholder=docunment.getElementById("placegolder");
   placeholder.setAttribute("src",source);
}
</script>
</head>
<body>
<h1>图片浏览</h1>
<ul>
<li><a href="images/firework.jpg" title="第一张图片" onclick="showpic(this);return stop();">firework</a></li>
</ul>
<img id="placeholder" src="images/placeholder.jpg" alt="my image gallery">

</body>
</html>

------解决方案--------------------
stop 怎么写的
------解决方案--------------------
你吧;改成,号试试