oElement.style.VISIBILITY = 'show'
改为
oElement.style.VISIBILITY = 'visible'

解决方案 »

  1.   

    我改成
    oElement.style.VISIBILITY = 'visible'了后
    还是显示不出来啊
      

  2.   

    我加了这一句后还是不行啊
    oElement.style.display=''
      

  3.   

    javascript大小写敏感。并且函数showLayer(LayerName)是个死循环,改写如下
    function showLayer(LayerName)
    {
       var oElement = document.getElementById(LayerName);
       if(oElement != null)
         oElement.style.visibility = 'visible';
    }
      

  4.   

    我试了一下,
    function showLayer(LayerName)
    {
       var oElement = document.getElementById(LayerName);
       if(oElement != null)
         oElement.style.visibility = 'visible';
    }
    这样下来总是oElement总是null

       if(oElement != null)
       {
           oElement.style.visibility = 'visible';
           alert("1");
       }
    根本就不会执行到 alert("1");啊,这是怎么回事啊
      

  5.   

    另外,我直接写
    Layer1.style.visibility = 'visible';
    居然说是
    错误:'Layer1.style'为空或不是对象
    这是怎么回事啊???
      

  6.   

    现在又发现
    function showLayer(LayerName)
    {
       var oElement = document.getElementById(LayerName);
       if(oElement != null)
         oElement.style.visibility = 'visible';
    }
    这样写又行了。
    可是Layer1还是没有出现在页面上
      

  7.   

    不可能啊,
    我试了一下可以啊
    你是不是在这个页面上定义了好几个Layer1啊,
    呵呵
      

  8.   

    <SCRIPT LANGUAGE=javascript>
    function showLayer(LayerID)
    {
    if( document.getElementById(LayerID)=="[object]")
    {
    var oElement = document.getElementById(LayerID);
    oElement.style.visibility="visible";
    }
    }
    </SCRIPT>
      

  9.   

    <script>
    function showLayer(LayerName)
    {
    LayerName.style.display = '';}
    function hide(LayerName)
    {
    LayerName.style.display = 'none';}
    </script>
    <a href="frame01.htm" target="mainFrame"><img border="0"
    onMouseover="showLayer(Layer1);this.src='images/caidan01b.gif'" 
                src="images/caidan01a.gif" onmouseout="hide(Layer1)"></a>      <DIV id=Layer1 
          style="Z-INDEX: 1; LEFT: 200px; display: none; WIDTH: 100px; POSITION: absolute; TOP: 110px; HEIGHT: 22px">
          <TABLE borderColor=#ffff00 cellSpacing=0 cellPadding=0 width=100% 
            border=1>
        <tr>
           <TD align=middle bgColor=#ffff00><A 
                      href="tree.aspx" 
                  target=_blank>tree</A></TD>
          <td>b</td>
          <td>c</td>
          <td>d</td>
          <td>e</td>
        </tr>
    </TABLE></DIV>
      

  10.   

    你的错误在于函数写法与调用方法不符合
    <img border="0" onMouseMove="showLayer(Layer1);this.src='images/caidan01b.gif'" 
                src="images/caidan01a.gif">
    showLayer(Layer1)
    你在这里调用的时候传入的是一个对象的id引用
    function showLayer(LayerName)
    {
    while( document.getElementById(LayerName) != null)
    {
    var oElement = document.getElementById(LayerName);
    oElement.style.VISIBILITY = 'show';
    }
    }
    但你的函数写的时候又将传入的参数当作字符串对待,当然出错:)
    修改的方法要么就是按我上边那么改写函数
    要么就修改调用方法:
    showLayer("Layer1"),然后按照前边朋友的指点修改你的函数。
      

  11.   

    多谢 xinyunyishui(心云意水)!!!