# 层问题，散分一百，求助！

fangxiaoan 2004-09-29 01:00:53

...全文
74 8 打赏 收藏 举报

8 条回复

ouyld 2004-09-29
• 打赏
• 举报

whnnet 2004-09-29
• 打赏
• 举报

<div onclick="x()" id=a1 style="position:absolute;width:500;height:500;background-color:red;">

<div id=a2 style="position:absolute;width:200;height:200;left:100;top:50;background-color:blue"> </div> </div>

<script>
function x()
{
document.all.a2.style.display=(document.all.a2.style.display=="none")?"":"none"
}
</script>
cuixiping 2004-09-29
• 打赏
• 举报

<div id=div1 onclick="t(this)" style="position:absolute;z-index:1;width:500;height:500;left:100;top:90;"> </div>
<div id=div2 onclick="t(this)" style="position:absolute;z-index:2;width:500;height:500;left:150;top:50;"> </div>
<div id=div3 onclick="t(this)" style="position:absolute;z-index:3;width:500;height:500;left:200;top:150;"> </div>
<script>
function t(e){
var z;
if(div1.style.zIndex > e.style.zIndex){
z=e.style.zIndex; e.style.zIndex=div1.style.zIndex; div1.style.zIndex =z;
}
if(div2.style.zIndex > e.style.zIndex){
z=e.style.zIndex; e.style.zIndex=div2.style.zIndex; div2.style.zIndex =z;
}
if(div3.style.zIndex > e.style.zIndex){
z=e.style.zIndex; e.style.zIndex=div3.style.zIndex; div3.style.zIndex =z;
}
}
</script>
whnnet 2004-09-29
• 打赏
• 举报

<script>
function a(o)
{
x=document.getElementsByTagName("DIV")
for(i=0;i<x.length;i++)
x[i].style.zIndex=1
o.style.zIndex=9999
}
</script>
<div id=a0 style="position:absolute;left:0;top:0;background-color:#333333;z-index:1;width:200;height:600">
<div id=a1 onclick="a(this)" style="position:absolute;left:10;top:10;background-color:red;z-index:11">层层层层层层层11111<p>层层层层层层层11111<p>层层层层层层层11111<p></div>
<div id=a1 onclick="a(this)" style="position:absolute;left:30;top:30;background-color:blue;z-index:12">层层层层层层层22222<p>层层层层层层层22222<p>层层层层层层层22222<p></div>
<div id=a1 onclick="a(this)" style="position:absolute;left:50;top:50;background-color:#00FF00;z-index:13">层层层层层层层33333<p>层层层层层层层33333<p>层层层层层层层33333<p></div>
</div>
cuixiping 2004-09-29
• 打赏
• 举报

whnnet 2004-09-29
• 打赏
• 举报

http://msdn.microsoft.com/workshop/author/css/css_node_entry.asp
whnnet 2004-09-29
• 打赏
• 举报

document.getElementById("DIVID").style.zIndex=999999

tanger104753507 2004-09-29
• 打赏
• 举报

8.7w+

Web 开发 JavaScript

2004-09-29 01:00