<tr id="importDiv"><td></td><td></td></tr>
有多列时
document.getElementById("importDiv").style.display = "block";
在ie下是对的
在firefox下,布局就乱了,tr正行会缩到第一个td里面我试了多中方法都不管用
document.getElementById("importDiv").style.display=" ";
document.getElementById("importDiv").style.cssText="display:‘ ’";请指教!小弟先谢过!

解决方案 »

  1.   

    我试了一下,没明白问题出在哪.<body>
    <table border="1">
    <tr id="importDiv" style="display: none;"> 
    <td>123456789</td> 
    <td>abcdefghg</td> 
    </tr> <tr> 
    <td><a href="#" onclick="btclick();">点击</a></td>
    <td></td>
    </tr> 
    </table>
    </body>
    </html>
    <script type="text/javascript">
    function btclick()
    {
    var importDiv=document.getElementById("importDiv");
    importDiv.style.display = "inline";

    }
    </script>
      

  2.   

    不好意思我没有说清楚,现在描述一下,图如下
    代码如下:
    <html>
    <head>
    <script type="text/javascript">
    function display() {
    var importDiv = document.getElementById("importDiv");
    importDiv.style.display = "inline";
    }
    function hide() {
    var importDiv = document.getElementById("importDiv");
    importDiv.style.display = "none";
    }
    </script>
    </head>
    <body>
    <table border="1">
    <tr>
    <td>你好</td>
    <td>hello</td>
    </tr>
    <tr id="importDiv" style="display: none;">
    <td>123456789</td>
    <td>abcdefghg</td>
    </tr>
    <tr>
    <td>我也好</td>
    <td>hi</td>
    </tr>
    <tr>
    <td><a href="#" onclick=display();>显示</a></td>
    <td><a href="#" onclick=hide();>隐藏</a></td>
    </tr>
    </table>
    </body>
    </html>
      

  3.   

    是不是ie版本的问题。我在ie8下看了下没问题。就把你的代码直接COPY过去的。。还使用了block也没问题
      

  4.   

    在firefox中,表格的display是:table-row,ie6不支持table-row,所以必须在你的代码中进行浏览器判断:
    function display() {
                    var importDiv = document.getElementById("importDiv");
                    if(window.ActiveXObject)
                         importDiv.style.display = "block";
                    else
                         importDiv.style.display = "table-row";
                }
      

  5.   

    谢谢,各位热心的帮助
    特别是new_bird_0001
    很好很强大
      

  6.   

    属性不正规 要用table-row
    http://www.w3school.com.cn/css/pr_class_display.asp