<script>
function top(i)
{
layer_1 = document.all['div1'].style.zIndex ;
layer_2 = document.all['div2'].style.zIndex ;
layer_3 = document.all['div3'].style.zIndex ;
max = Math.max(layer_1,layer_2,layer_3) ;
document.all['div'+i].style.zIndex = max + 1 ;
}
</script><span onclick="top(1)">第一层</span>
<span onclick="top(2)">第二层</span>
<span onclick="top(3)">第三层</span>
<div id=div1 style="filter:alpha(opacity=80); width:100px; height:100px; border:1px solid black; background-color:#ff0000; z-index:0; position:relative; top:0px""></div>
<div id=div2 style="filter:alpha(opacity=80); width:100px; height:100px; border:1px solid black; background-color:#ffff00; z-index:1; position:relative; top:-80px"></div>
<div id=div3 style="filter:alpha(opacity=80); width:100px; height:100px; border:1px solid black; background-color:#0000ff; z-index:2; position:relative; top:-160px"></div>