<!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN">
<html>
??<head>
????<base?href="<%=basePath%>">
????
????<title>Test?Page</title>
<script?type="text/javascript"?src="js/jquery-1.11.1.min.js"></script>
<link?rel="stylesheet"?type="text/css"?href="css/common.css"?/>
??</head>
??<script?type="text/javascript">
?? $(function(){
?? $(".thumbs?a").click(function(){
?? var?largePath?=?$(this).attr("href");
?? var?largeAlt?=?$(this).attr("title");
?? $("#largeImg").attr({
??
?? src:largePath,
?? alt:largeAlt
?? });
?? return?false;
?? });
?? });
??</script>
??<body>
??????<h2>圖片預覽</h2>
????<p?id="largeImg">
???? <img?src="images/img1-lg.jpg"?alt="largeImg"?/>
????</p>
????<p?class="thumbs">
???? <a?href="images/img2-lg.jpg"?title="Image2"><img?src="images/img2-thumb.jpg"?/></a>
???? <a?href="images/img3-lg.jpg"?title="Image3"><img?src="images/img3-thumb.jpg"?/></a>
???? <a?href="images/img4-lg.jpg"?title="Image4"><img?src="images/img4-thumb.jpg"?/></a>
???? <a?href="images/img5-lg.jpg"?title="Image5"><img?src="images/img5-thumb.jpg"?/></a>
???? <a?href="images/img6-lg.jpg"?title="Image6"><img?src="images/img6-thumb.jpg"?/></a>
????</p>
??</body>
</html>
2016-06-22
我寫到img里面,也還是沒有效果,咋回事
2015-03-09
O(∩_∩)O~,我剛剛也發現了,沒想到你自己回答了!我也時常犯這種小錯誤!
2015-03-08
我把id="largeImg"寫到p標簽里了,所以沒有效果