鼠标放上去显示图片效果

<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.xuejiehome.com/images/logo.png" alt="雪洁之家" onmousemove="show(event,'http://www.xuejiehome.com/images/logo.png','xuejiehome.com')" 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>


by 雪洁 2010-10-27 18:21:47 5190 views

1 Comments

蒋艺轩 2018-08-15 15:10:07
厉害了 !我是个游戏美术,自己弄了个网站,学习新功能使用!感谢 !
雪洁 2018-08-15 15:10:22
客气了~
我来说几句

相关文章