您的位置:首页 > Web前端 > JavaScript

javascript获取鼠标坐标跟随控制层渐显信息提示效果(有BUG在调试中)

2008-05-31 17:34 876 查看
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
function mo()
{
var x=event.clientX,y=event.clientY;
//alert(ccc.offsetHeight+","+ccc.style.marginBottom);
if(document.getElementById&&!document.all) obj=document.getElementById("sh");
if(document.all) obj=document.all.sh;
if(document.layers) obj=document.layers.sh;
if(obj.style.visibility=='hidden')
{
var width=10;
var height=20;
obj.style.left=x+'px';
obj.style.top=y+'px';
obj.style.visibility='visible';
var timer = setInterval(function ()
{
width=width+10;
height=height+20;
if(height<200)
{
obj.style.width=width+'px';
obj.style.height=height+'px';
}
else{ clearInterval(timer);obj.innerHTML='华夏中文社区欢迎你的到来,谢谢支持';}
},1);
}
else
{
var width=100;
var height=200;
obj.innerHTML='';
var timer = setInterval(function ()
{
width=width-10;
height=height-20;
if(height>0)
{
obj.style.width=width+'px';
obj.style.height=height+'px';
}
else{ clearInterval(timer);obj.style.visibility='hidden';}
},1);
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>js牛X的信息提示效果</title>

<style type="text/css">
<!--
body {
margin-top: 200px;
}
-->
</style></head>

<body>
<div id="sh" style="left:500px; top:300px; width:200px; height:50px; position:absolute; visibility: hidden; filter: progid:DXImageTransform.Microsoft.Shadow
(Color=#333333,Direction=130,strength=2) alpha(opacity=30) BlendTrans(duration=1); border:solid #999999 1px;z-index:1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span style="color:#000000">http://www.hxzw.net</span>
</td>
</tr>
</table>
</div>
<table width="250" border="0" cellspacing="0" cellpadding="0" id="ccc">
<tr>
<td height="25"><a href="http://www.hxzw.net" target="_blank" onmouseover="mo()" onmouseout="mo()">http://www.hxzw.net</a></td>
</tr>
</table>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: