注册 登录
编程论坛 ASP技术论坛

关于DIV层的上下显示问题,请指点?

tiaoyuan 发布于 2009-11-06 12:10, 1101 次点击
<div id="11" style=" position:relative;width:100px; height:40px; background-color:#CCC; ">1212
    <div id="22" style="position:absolute; width:300px; height:300px; background-color:#3CF; top:20px; left:20px;"></div>
</div>

<div id="33" style=" position:relative;width:100px; height:40px; background-color:#F00; "></div>


22是当鼠标经过11时弹出浮动来的层,现在就是不知用什么办法33不挡住22????

前提:11 和 33 都是用同一个 class 样式的。

有解决方法吗?   


已经问过很多人都不行,呜呜,希望大家能帮帮忙。
10 回复
#2
aspic2009-11-06 14:39
首先要告诉你 id不能数字开头
#3
aspic2009-11-06 14:40
其次 遮挡问题 应该用z-index设置层次
#4
aspic2009-11-06 14:45
程序代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. xmlns="http://www. http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<div id="l1" style="position:relative;width:100px; height:40px; background-color:#CCC;z-index:100">
    <div id="l2" style="position:absolute;width:300px;height:300px;background-color:#3CF;top:20px;left:20px; display:none">22222222222</div>
</div>
<div id="l3" style="position:relative;width:100px; height:40px; background-color:#F00; z-index:99">333333333</div>
<script>
$ = function(id) {return typeof id == 'string' ? document.getElementById(id) : id};
$('l1').onmouseover = function() {
    $('l2').style.display = 'block'
};
$('l1').onmouseout = function() {
    $('l2').style.display = 'none'
}
</script>
</body>
</html>
#5
tiaoyuan2009-11-06 17:08
回复 4楼 aspic


说明一下:
1.那id 是没有用的。只是说明给大家知道我是想说那个层而以
2,11 和 33 都是用同一个 class 样式的。看到楼上的回复,11 和 33 里的style已经不同了。这样不行。

只有本站会员才能查看附件,请 登录

就是这里出问题。。 。firefox和IE8谷歌浏览器是可以的,其它IE的都不行。。。



代码如下:

只有本站会员才能查看附件,请 登录
#6
aspic2009-11-06 17:15
东西是死的 人是活的
#7
tiaoyuan2009-11-06 17:17
以下是引用aspic在2009-11-6 17:15:01的发言:

东西是死的 人是活的


效果一样,用不同的方法也可以的。呵呵,。本人水平有限,就是不知如何解决。。。就指点指点吗?



谢谢
#8
aspic2009-11-06 17:48
明显我给的例子就可以
#9
tiaoyuan2009-11-06 21:44
回复 8楼 aspic
你的代码都是写上 z-index ,但这样不太符合我的用的代码哦。。不好意思。。我不太懂。。。。请帮帮忙。。
#10
aspic2009-11-07 16:52
这个东西不用z-index貌似不可能 如果有可以解决的方法发出来共享一下
#11
aspic2009-11-07 17:00
明明你自己的css里都一堆z-index
1