背景:
阅读新闻

鼠标经过放大图像,JS浮动层放大图像

[日期:2013-11-07] 来源:  作者: [字体: ]
<html>
<head>
<title>鼠标经过弹出浮动层,放大图像</title>
<script type="text/javascript">
function picshow()
{
var a=document.getElementById("m")
a.style.visibility='visible'
a.style.top=event.clientY
a.style.left=event.clientX
}
function picmove()
{
var b=document.getElementById("m")
b.style.top=event.clientY
b.style.left=event.clientX
}
function pichide()
{
var c=document.getElementById("m")
c.style.visibility='hidden'
}
function trfunc()
{
var d=document.getElementsByTagName("tr")
var len=d.length;
d[1].attachEvent("onmouseover",picshow);
d[1].attachEvent("onmousemove",picmove);
d[1].attachEvent("onmouseout",pichide);
}
</script>
</head>
<body onload="trfunc()">
<div id=m style="position:absolute;top:0;left:0;visibility:hidden;padding:3px;border:1px solid #528AC6;background-color:#ffdfd0;" >//隐藏层
<img src="/uploads/common/images/p5.jpg" width="400" height="300">
</div>
<table   border=1>
<tr>
<td>test</td>
</tr>
<tr>//获取鼠标onmouseon
<td   colspan=4><img src="/uploads/common/images/s_p5.jpg" width="80" height="80"></td>
</tr>
</table>
</body>
</html>
收藏 推荐 打印 | 录入:admin | 阅读:
相关新闻      
本文评论   [发表评论]   全部评论 (0)
热门评论