onmouseover,onmouseout问题
各位帮帮忙!怎样在onmouseoutsh事件里面让div层停留啊,
function over()
{
document.getElementById("divUserLogin").style.display="";
}
function out()
{
document.getElementById("divUserLogin").style.display="none";
}
<a class="ext" id="HD05" title="登录后有更多服务" href="#" onmouseover="over()" onmouseout="out()">登 录</a>
<div id="divUserLogin" style="width: 80px; height: 100px; position: absolute; left: -45px; top: 28px; background-color:#663399;display:none; z-index:1">
<div style="width: 211px; height: 113px; left: 10px; top: 34px;">
<br />
手机号(即卡号) 密码<br />
<input id="username" runat="server" style="width: 85px; " />
<input class="text" runat="server" id="password" type="password" style="width: 85px" /><br />
<div style="float:right; width:50%;"><br />
<asp:button id="btnLogin" runat="server" cssclass="btn1_mouseover" text="登 陆" /></div>
<br />
<div style="float:right; width:80%"> <a href="Login.aspx" style="font-size: 14px; color:White; text-decoration:none"> 新人?请在此注册!</a></div>
</div>
</div>
------解决方案--------------------
加个一变量,定时为5秒才关闭
var inttime=5;
function over()
{
document.getElementById("divUserLogin").style.display="";
inttime=5;
}
function out()
{
if(inttime==0)
{
document.getElementById("divUserLogin").style.display="none";
}
else
{
inttime--;
window.setTimeout("out()",1000);
}
}
如果是在调出的div中有关闭按钮,
那按钮的事件中一般要立即关闭,那就把inttime的值设置为0,然后调用out或者重写一个方法