日期:2014-05-17  浏览次数:20590 次

求个图片展示窗
想做个图盘展示窗 如图,当点击右边的小图时左边的大图跟着变为点击图片。

------解决方案--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
img{
width:40px;
height:40px;
}
</style>
<script type="text/javascript">
function init(){
var images=document.images;
for(var i=0;i<images.length;i++){
if(!images[i].getAttribute("id")){
images[i].onclick=change;
}
}
}
function change(){
document.getElementById("test").setAttribute("src",this.getAttribute("src"));

window.onload=init;
</script>
</head>

<body>
<img src="1.jpg" /><img src="2.jpg" /><img src="3.jpg" /><img src="4.jpg" />
<br/>
<img src="" id="test" style="width:400px; height:400px;">
</body>
</html>
看不到你的图片啊