鼠标经过显示层

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">  
</head>
<body>
    
<form id="form1" runat="server">
    问题:当绿色的DIV显示出来后,鼠标移入DIV无事,再移到aaaa正上方的一小部分局域(就aaaa四个字母上方),DIV就关了,不知为何
    
<div style="margin:0px auto 0px auto; position:absolute;left:250px;top:250px;padding:20px; z-index:1;">   
        
<asp:LinkButton ID="LinkButton1" onmouseover="over(this,document.all.se)" onmouseout="timer=setTimeout('out(document.all.se)',500)" OnClientClick="alert('left'+this.offsetLeft+';top'+this.offsetTop+';高'+this.offsetHeight+';宽'+this.offsetWidth);return false;" runat="server">M我</asp:LinkButton>
        
    
</div>
    

    
   
    
<div id="se" onmouseover="clearTimeout(timer);this.style.display='block'" onmouseout="out(this)" style=" background-color:#32ba5c; display:none; width:200px; position:absolute; padding:20px;">       
        
<div >aaaa</div>
        
<div >bbbb<input type="button" onclick="this.parentElement.parentElement.style.display='none'" value="关闭" /></div>
        
<div>aaaa</div>
        
<div>bbbb</div>
        
<div>aaaa</div>
        
<div>bbbb</div>       
    
</div>
    
  
    
   
    
</form>
</body>
</html>
<script>
    
function over(obj,div)
    
{
         
var rec=getoffset(obj);
         div.style.top
=rec[0]+obj.offsetHeight;
         div.style.left
=rec[1];     
         div.style.display
="block";        
    }

    
    
function out(div)
    
{
        div.style.display
="none";
    }


function getoffset(e) 
{  
 
var t=e.offsetTop;  
 
var l=e.offsetLeft;  
 
while(e=e.offsetParent) 
 
{  
  t
+=e.offsetTop;  
  l
+=e.offsetLeft;  
 }
  
 
var rec = new Array(1); 
 rec[
0]  = t; 
 rec[
1= l; 
 
return rec 
}
  

</script> 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值