var html=''
//遍历数组插入img标签到页面
for(var i=0i<arrImgs.lengthi++){
html+='<img src="'+arrImgs[i]+'" />'//创建img标签,图片地址赋值src
}
document.getElementById("要插入的容器id").innerHtml=html
可以利用层来实现。<html>
<head>
<title>图片的显示</title>
<style type="text/css">
<!--
#bg1 {
position:absolute
width:162px
height:115px
z-index:1
}
#bg2 {
position:absolute
width:162px
height:115px
z-index:1
left: 1px
top: 1px
display:none
}
#b1 {
position:absolute
width:22px
height:21px
z-index:2
left: 60px
top: 201px
}
#b2 {
position:absolute
width:22px
height:24px
z-index:3
left: 84px
top: 203px
}
-->
</style>
<script>
function showbg1(){
document.getElementById("bg1").style.display="block"
document.getElementById("bg2").style.display="none"
}
function showbg2(){
document.getElementById("bg1").style.display="block"
document.getElementById("bg2").style.display="block"
}
</script>
</head>
<body>
<div id="bg1"><img src="mao.jpg" width="160" height="180" />
<div id="bg2"><img src="haitun.jpg" width="160" height="180" /></div>
</div>
<p></p>
<div id="b1" onmousemove="showbg1()"><img src="b1.png" width="22" height="20" /></div>
<div id="b2" onmousemove="showbg2()"><img src="b2.png" width="18" height="19" /></div>
</body>
</html>