设置鼠标移入移出事件onmouseover="over(this,this.src)" onmouseout="out(this)"
<div id="divbigimage" style="display:none;300px;height:300px;position:absolute;"> <img src="" id="big" style="300px; height:300px"/> </div>
ps:div的位置要放对,一般多个页面组合的,要放在主页面上
function over(obj_small,obj_big){ var divx = window.event.clientX; var divy = window.event.clientY; var divmove = document.getElementById("divbigimage"); divmove.style.left = divx+'px'; divmove.style.top = divy+'px'; obj_small.style.border="solid 1px blue"; document.getElementById("big").src=obj_big; document.getElementById("divbigimage").style.display="block"; } function out(obj_small){ obj_small.style.border=0; document.getElementById("divbigimage").style.display="none"; }