<style>
div{t:expression(this.onclick=function(){show(this)})}
</style>
<script>
function show(obj)
{
  if(/lay3498/.test(obj.id)) 
   {
      for(var i=1;i<=3;i++)
        {
          document.getElementById('lay3498_3_'+i.toString()).style.zIndex=document.getElementById('lay3499_1_1').style.zIndex+1;
        }
   }
   else
   {
      for(var i=1;i<=3;i++)
        {
          document.getElementById('lay3498_3_'+i.toString()).style.zIndex=document.getElementById('lay3499_1_1').style.zIndex-1;
        }
   }}
</script>
<body>
<div id="lay3498_3_1" onClick="" style="position:absolute; width:720px; height:20px; z-index:3498;left:277px; top: 169px; background-color: #FFCCCC; layer-background-
     color: #FFCCCC; border: 1px none #000000;">
     <table width="100%" height="20" border="1" bgcolor="#FFBFAA" cellpadding="0" 
         cellspacing="0">
         <tr>
            <td>
              <a href="" title="标题1" onClick="openurl(id);return false;">&nbsp;</a>
            </td>
         </tr>
     </table>
</div>
<div id="lay3498_3_2" onClick="" style="position:absolute; width:720px; height:20px; z-index:3498;left:277px; top: 242px; background-color: #FFCCCC; layer-background-
     color: #FFCCCC; border: 1px none #000000;">
     <table width="100%" height="20" border="1" bgcolor="#FFBFAA" cellpadding="0" 
         cellspacing="0">
         <tr>
            <td>
              <a href="" title="标题2" onClick="openurl(id);return false;">&nbsp;</a>
            </td>
         </tr>
     </table>
</div>
<div id="lay3498_3_3" onClick="" style="position:absolute; width:720px; height:20px; z-index:3498;left:277px; top: 355px; background-color: #FFCCCC; layer-background-
     color: #FFCCCC; border: 1px none #000000;">
     <table width="100%" height="20" border="1" bgcolor="#FFBFAA" cellpadding="0" 
         cellspacing="0">
         <tr>
            <td>
              <a href="" title="标题3" onClick="openurl(id);return false;">&nbsp;</a>
            </td>
         </tr>
     </table>
</div>
<div id="lay3499_1_1" onClick="" style="position:absolute; width:720px; height:20px; z-index:3499;left:290px; top: 355px; background-color: #FFCCCC; layer-background-
     color: #FFCCCC; border: 1px none #000000;">
     <table width="100%" height="20" border="1" bgcolor="#FFBFAA" cellpadding="0" 
         cellspacing="0">
         <tr>
            <td>
              <a href="" title="标题3" onClick="openurl(id);return false;">&nbsp;</a>
            </td>
         </tr>
     </table>
</div></body>

解决方案 »

  1.   

    楼上的兄弟,你太厉害了,代码实现了功能,居然跟onClick="openurl(id)“无关,想不到JAVASCRIPT原来还有那么多值得学习的地方
      

  2.   

    vivianfdlpw:
    请问if(/lay3498/.test(obj.id)) 中的代码是什么意思,能否解释一下,此外,我需要单击页面其他地方,图层回到原来的状态,还有,如果图层ID为layer001_n_m,这样的形式怎么写代码,谢谢