jsp 显示代码如下:
<%@ page language="java" contentType="text/html"
pageEncoding="utf-8"%>
<html>
<head>
<title>Insert title here</title>
<script src="./js/thumbnails.js" type="text/javascript"></script>
</head>
<body>
<div>
<div id="thumbnailPane">
<img src="./abc/a.jpg" id="a" width="200" height="155" title="a">
<img src="./abc/b.jpg" id="b" width="200" height="155" title="b">
<img src="./abc/c.jpg" id="c" width="200" height="155" title="c">
</div>
<div id="detailsPane">
<img src="./abc/d.jpg" id="d" width="420" height="365" title="d">
</div>
</div>
</body>
</html>
js 代码如下
window.onload = initPage;
function initPage(){
thumbs = document.getElementById("thumbnailPane").getElementsByTagName("img");
for(var i=0;i<thumbs.length;i++){
arr=thumbs[i];
//鼠标放上去显示。
arr.οnmοuseοver=function(){
//点击鼠标显示
// arr.οnclick=function(){
detailURL='./abc/'+this.title+'.jpg';
document.getElementById("d").src=detailURL;
}
}
}
图片在附件中: