鼠标经过放大图像,JS浮动层放大图像
2013/11/7 10:30:34
<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>

返回列表
返回首页
©2024 金松软件
Powered by iwms