日期:2014-05-16 浏览次数:20371 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.onload=function(){
var d1=document.getElementById("d1");
var d2=document.getElementById("d2");
d1.onmouseover=function(){
d2.style.display="block";
};
d1.onmouseout=function(){
d2.style.display="none";
}
}
//-->
</SCRIPT>
<BODY>
<a id="d1" href="#" style="text-decoration:none;">aaa</a>
<div id="d2" style="width:60px;height:30px;border:1px solid red;background-color:blue;display:none">
</div>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<SCRIPT LANGUAGE="JavaScript">
window.onload=function(){
var d1=document.getElementById("d1");
var d2=document.getElementById("d2");
d2.onmouseover=function(){clearTimeout(timer);}//移动到层上清除计时器
d2.onmouseout=function(){ d2.style.display="none"}
d1.onmouseover=function(){clearTimeout(timer);//////
d2.style.display="block";
};
var timer
d1.onmouseout=function(){
timer=setTimeout(function(){ d2.style.display="none";},200);//用计时器来隐藏,如果距离很远间隔要放大一些
}
}
</SCRIPT>
<BODY>
<a id="d1" href="#" style="text-decoration:none;">aaa</a>
<div id="d2" style="width:60px;height:30px;border:1px solid red;background-color:blue;display:none">
</div>
</BODY>
</HTML>