两个层交互问题

justxd 2007-08-07 09:11:38

下面是完整的HTML代码,当执鼠标放到"显示/隐藏"层上弹出一层,但无法点击弹出层的链接,,呵呵!(如果数据不是动态加载的则可以),帮忙看一下,谢谢!
<html>
<head>
<title>层交互</title>
<style>
body{text-align:center;}
#dvCon{position:absolute;width:200px;height:200px;border:1px solid #0099ff;background:#446699;visibility:hidden;z-index:1000;cursor:hand;}
#dvHiddenShow{font-size:12px;color:orange;position:absolute;width:200px;height:200px;background:#4488cc;line-height:200px;}
a{}
a:hover{}
a:visit{}
</style>
<script>
function mouseov()
{


var dv=document.getElementById("dvCon");
//加载数据
createCityData(dv);

dv.style.visibility="visible";
if(mouseov.arguments.length>0)
{
dv.style.left=mouseov.arguments[0].offsetLeft+80;
dv.style.top=mouseov.arguments[0].offsetTop+50;

}



}
function mouseou()
{
var dv=document.getElementById("dvCon");
dv.innerHTML="";
dv.style.visibility="hidden";
}

function createCityData(ele)
{
for(var i=0;i<10;i++)
{
var eleTagA=document.createElement("a");
var eleTagBr=document.createElement("br");
eleTagA.href="http:www.baidu.com";
eleTagA.innerHTML="www.baidu.com";
eleTagA.onmouseover=function(){mouseov();}
eleTagA.onmouseout=function(){mouseou();}
ele.appendChild(eleTagA);
ele.appendChild(eleTagBr);
}
}
</script>
</head>
<body>

<div id="dvCon" onmouseover="mouseov()" onmouseout="mouseou()">
</div>
<div id="dvHiddenShow" onmouseover="mouseov(this)" onmouseout="mouseou(this)">
显示/隐藏
</div>

</body>
</html>
...全文
100 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
浪尖赏花 2007-08-07
  • 打赏
  • 举报
回复
<html>
<head>
<title>层交互</title>
<style>
body{text-align:center;}
#dvCon{position:absolute;width:200px;height:200px;border:1px solid #0099ff;background:#446699;visibility:hidden;z-index:1000;cursor:hand;}
#dvHiddenShow{font-size:12px;color:orange;position:absolute;width:200px;height:200px;background:#4488cc;line-height:200px;}
a{}
a:hover{}
a:visit{}
</style>
<script>
function mouseov()
{
if(event.toElement.parentNode.id=="dvCon")return;
var dv=document.getElementById("dvCon");
//加载数据
createCityData(dv);
dv.style.visibility="visible";
if(mouseov.arguments.length>0)
{
dv.style.left=mouseov.arguments[0].offsetLeft+80;
dv.style.top=mouseov.arguments[0].offsetTop+50;
}
}
function mouseou()
{
if(event.toElement.parentNode.id=="dvCon")return;
var dv=document.getElementById("dvCon");
dv.innerHTML="";
dv.style.visibility="hidden";
}
function createCityData(ele)
{
for(var i=0;i<10;i++)
{
var eleTagA=document.createElement("a");
var eleTagBr=document.createElement("br");
eleTagA.href="http://www.baidu.com";
eleTagA.innerHTML="www.baidu.com";
eleTagA.onmouseover=function(){mouseov();}
eleTagA.onmouseout=function(){mouseou();}
ele.appendChild(eleTagA);
ele.appendChild(eleTagBr);
}
}
</script>
</head>
<body>
<div id="dvCon" onmouseover="mouseov()" onmouseout="mouseou()">
</div>
<div id="dvHiddenShow" onmouseover="mouseov(this)" onmouseout="mouseou(this)">
显示/隐藏
</div>
</body>
</html>

87,918

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧