用 
document.all.testdiv.style.visibility = "hidden";//隐藏

document.all.testdiv.style.visibility = "visible";//可见
代替原来的试试

解决方案 »

  1.   

    用个图片按钮就ok了。如果要隐藏按钮,把按钮放在一个div里面让div层隐藏就 可以了。
      

  2.   

    visibility=“hidden”元素不显示,但是原位值不便,display="none"这个元素就不存在了 
      

  3.   

    其实我是想知道怎么动态控制table的高度.我截2张图片表示这种效果:起始:
    变化后:代码如下:
    <body>
    <table align="center" width="510" height="386" border="1" cellpadding= "0" cellspacing= "0">
      <tr>
        <td colspan="3"><table width="510" height="33" border="1" cellpadding= "0" cellspacing= "0" style="position:relative">
          <tr>
            <td width="61" height="33">&nbsp;</td>
            <td>&nbsp;</td>
            <td width="111">&nbsp;</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td colspan="3" width="510" height="25"><table width="510" height="25" border="1" cellpadding= "0" cellspacing= "0" style="position:relative">
          <tr>
            <td width="10" >&nbsp;</td>
            <td width="490" >&nbsp;</td>
            <td width="10">&nbsp;</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td colspan="3" height="328"><table width="510" height="328" border="1" cellpadding= "0" cellspacing= "0">
          <tr>
            <td width="10"></td>
            <td><table width="490" height="328" border="1" style="position:relative" cellpadding= "0" cellspacing= "0">
              <tr>
                <td height="102"><div style="background-image:url(qie2/01.jpg); width:452px; height:102px; position:absolute; left: 16px; top: 4px;">
                </div></td>
              </tr>
              <tr>
                <td height="102"><div style="background-image:url(qie2/01.jpg); width:452px; height:102px; position:absolute; left: 14px; top: 114px;"></div></td>
              </tr>
              <tr id="testdiv">
                <td height="102"><div style="background-image:url(qie2/01.jpg); width:452px; height:102px; position:absolute; left: 14px; top: 223px;"></div></td>
              </tr>
            </table></td>
            <td width="10"></td>
          </tr>
        </table></td>
      </tr>
      
      <tr>
        <td width="73" height="13"></td>
        <td width="364"></td>
        <td width="73"></td>
      </tr>
    </table>
    <input type="button" name=hiddendiv value="隐藏" onClick="javascript:return document.all.testdiv.style.display='none'">--------<换成document.all.testdiv.style.visibility = "hidden";空白位置肯定存在,我希望的效果是没空白位置>
    <input type="button" name=showdiv value="显示"onClick="javascript:return document.all.testdiv.style.display='block'">
    </body>
      

  4.   

    不行啊....document.all.testdiv.style.visibility = "hidden";表格的高度不会变
      

  5.   

    解决了。。必须用JS控制table高度。。哎。。我还以为可能自动匹配呢
      

  6.   

    哈哈,,,,table肯定要控制的