這里html頁面<!DOCTYPE?html>
<html?lang="en">
<head>
????<meta?http-equiv="content-type"??content="text/html;?charset=utf-8"?>
????<title>Image?gallery</title>
????<script?type="text'javascript"?src="js/showPic.js"></script>
????<link?rel="stylesheet"?href="css/layout.css"?type="text/css"?/>
</head>
<body>
????<h1>Snapshots</h1>
????<ul>
????????<li>
????????????<a?href="images/fireworks.jpg"?title="A?fireworks?display"?onclick="showPic(this);?return?false;">Fireworks</a>
????????</li>
????????<li>
????????????<a?href="images/coffee.jpg"?title="A?cup?of?black?coffee"?onclick="showPic(this);?return?false;">Coffee</a>
????????</li>
????????<li>
????????????<a?href="images/rose.jpg"?title="A?red,?red?rose"?onclick="showPic(this);?return?false;">Rose</a>
????????</li>
????????<li>
????????????<a?href="images/bigben.jpg"?title="The?famous?clock"?onclick="showPic(this);?return?false;">Big?Ben</a>
????????</li>
????????
????</ul>
????<img?id="placeholder"?src="images/placeholder.gif"?alt="my?image?gallery"?/>
????<p?id="description">Choose?an?image.</p>
</body>
</html>這是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;
}現(xiàn)在點擊鏈接想取消跳轉(zhuǎn)效果,但是一直取消不掉,該腫么辦???
JS實現(xiàn)點擊鏈接取消跳轉(zhuǎn)效果的方法 return false;不好使,該腫么辦?
Gavin_Alison
2016-09-14 14:19:34