<script language=JavaScript>
function changeshow(){
   document.getElementById("imim").style.display="none";
}
</script>
<img src="images/button.gif" onclick="changeshow()";>
<img id=imim src="images/index.gif" width="227" height="107">

解决方案 »

  1.   

    非常感谢wangxiaomax(缺省值),刚才的问题解决了
    改了一下代码,发现又有新的问题:
    <script language=JavaScript>
    function changeshow(){
       if(document.getElementById("imim").style.display=="none")
       document.getElementById("imim").style.display="block";
       else
       document.getElementById("imim").style.display="none";
    }
    </script>
    <table border="1">
      <tr> 
        <td onclick="changeshow()";>click</td>
      </tr>
      <tr id=imim> 
        <td><img src="images/index_05.gif" width="227" height="107"></td>
      </tr>
      <tr>
        <td><img src="images/index_02.gif" width="287" height="132" ></td>
      </tr>
    </table>
    还是老问题,ie里imim点击隐藏后再点击就会出来,但netscape里面点击隐藏再点击就怎么都出不来了...-_-...
      

  2.   

    <script language=JavaScript>
    function changeshow(){
       if(document.getElementById("imim").style.visibility=="hidden")
       document.getElementById("imim").style.visibility="visible";
       else
       document.getElementById("imim").style.visibility="hidden";
    }
    </script>
    <table border="1">
      <tr> 
        <td onclick="changeshow()";>click</td>
      </tr>
      <tr id=imim> 
        <td><img src="images/index_05.gif" width="227" height="107"></td>
      </tr>
      <tr>
        <td><img src="images/index_02.gif" width="287" height="132" ></td>
      </tr>
    </table>
      

  3.   

    用visibility只会隐藏,那空的地方仍会留着的.
    我想用display,因为他它会连空间也缩回去的.谢谢wangxiaomax(缺省值) 真的没办法了么...
      

  4.   

    <script language=JavaScript>
    function changeshow(){
       document.getElementById("imim").style.display="none";
    }
    </script>
    <img src="images/button.gif" onclick="changeshow()";>
    <img id=imim src="images/index.gif" width="227" height="107">
      

  5.   

    干脆你这样,ID不要用在TR上,还是用在IMG上。因为NETSCAPE对TR的DISPLAY属性支持不好。
    <script language=JavaScript>
    function changeshow(){
       if(document.getElementById("imim").style.display=="none")
       document.getElementById("imim").style.display="block";
       else
       document.getElementById("imim").style.display="none";
    }
    </script>
    <table border="1">
      <tr> 
        <td onclick="changeshow()";>click</td>
      </tr>
      <tr > 
        <td><img id=imim src="images/Js_ico1.gif" width="227" height="107"></td>
      </tr>
      <tr>
        <td><img src="images/Js_ico2.gif" width="287" height="132" ></td>
      </tr>
    </table>
      

  6.   

    这样img隐藏后还会有一段空格在tr里面的。-_-...