解决方案 »
- javascript为什么显示不出来背景
- 帮忙看看这个正则表达式
- js动态创建table的问题
- 怎样显示带有格式的文本?
- 请教大家一个简单的小问题,很急,在线等
- 帮忙,如何滑动出现半透明层?
- 在一个h包含tml页面上任意取两段文本,作为开始和结束的标志,如何才能用javascript将包含这两段文本的一个完整,范围最小的
- 谁知道怎样使系统扬声器发音?
- 求验证日期格式及日期部分的正则表达式
- 照抄书里的代码但函数无法执行、求分析( Uncaught ReferenceError: xxx is not defined)
- 手机高德地图开发
- form2的提交依赖于form1、怎么样用一个submit提交将form1提交成功后再提交form2~??
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="common.css" type="text/css" rel="stylesheet" />
<title>弹出层</title><style>
div{padding:50px;}
.box{background:red;}
.box1{background:blue;}
</style>
<script>
window.onload=function(){
var oBox=document.getElementById('box');
//方案一:采用定时器来解决
/*var iTimer=null;
oBox.onmouseout=function(){
iTimer=setTimeout(function(){
oBox.style.display='none';
},40);
}
oBox.onmouseover=function(){
clearTimeout(iTimer);
}*/
//方案二:移出改为事件onmouseleave
oBox.onmouseleave=function()
{
this.style.display='none';
}
}
</script>
</head>
<body>
<div class="box" id="box">
<div class="box1" id="box1"></div>
</div>
</body>
</html>
我的事件监听使用了onmouseout