只是鼠标悬浮在DIV上是显示图片,出了DIV范围隐藏图片的话,DIV的onmouseout和onmouseover就可以搞定。
但是图片是可以点击的,这样的话用onmouseout就不行了。
DIV不止一个,且没有ID。<a id="Layer_a" href="#" target="_blank" style="display: none; position: absolute;z-index: 1;">
       <img src="../../images/betterTip/help.png" alt="" />
</a>
<div onmouseover="showPic('www.123.com');">if</div>
<div onmouseover="showPic('www.456.com');">else</div>
 function showPic(str) {
       document.getElementById("Layer_a").style.left = event.x;
       document.getElementById("Layer_a").style.top = event.y;
       document.getElementById("Layer_a").href = str;
       document.getElementById("Layer_a").style.display = "block";
}
function hiddenPic() {
       document.getElementById("Layer_a").style.display = "none";
}当鼠标悬浮到div上的时候,显示Layer_a,然后可以点击Layer_a弹出新页面。
当鼠标不div范围的时候Layer_a隐藏。