`
Spring_Mvc
  • 浏览: 3904 次
文章分类
社区版块
存档分类
最新评论

鼠标放上去显示图片

阅读更多
<div id="a1" style=" position:absolute; z-index:2;"></div>

      <table width="200" border="0" cellpadding="0" cellspacing="0">
   <tr>
     <td><img src="http://www.baidu.com/img/baidu_logo.gif" alt="hi.baidu.com/liwya" onmousemove="show(event,'http://www.baidu.com/img/baidu_logo.gif','hi.baidu.com/liwya')"   onmouseout="hide(this)" /></td>
   </tr>
</table>

<script>
function show(event,_this,mess) {
    event = event || window.event;
    var t1="<table     cellspacing='1' cellpadding='10' style='border-color:#CCCCCC;background-color:#FFFFFF;font-size:12px;border-style:solid;    border-width:thin;text-align:center;'><tr><td><img src='" + _this   + "' width='300' height='225' >    <br>"+mess+"</td></tr></table>";
     document.getElementById("a1").innerHTML =t1;
      //document.getElementById("a1").innerHTML = "<img src='" + _this.src + "' >";
   document.getElementById("a1").style.top   = document.body.scrollTop + event.clientY + 10 + "px";
   document.getElementById("a1").style.left = document.body.scrollLeft + event.clientX + 10 + "px";
    document.getElementById("a1").style.display = "block";
}
function hide(_this) {
     document.getElementById("a1").innerHTML = "";
document.getElementById("a1").style.display = "none";
}
</script>

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics