2011-11-22 19 views
1

這是我的代碼。我在html中的表格列自動增加

<table id="addComments" style="width:430px; table-layout:fixed; display:none; padding-right:3px; padding-left:3px;"> 

       <tr> 
       <td colspan="3"> 
       <textarea id="textArea" rows="15" cols="0" style="width:430px; overflow:hidden;"></textarea> 
       </td> 
       </tr> 

       <tr> 

       <td> 
       <div id="noComments" style="color:red; display:none;">Please write your comments.</div> 
       </td> 

        <td> 
       here is some image whose display is none 
        </td> 

       <td> 
       <input id="commentBtn" type="button" onclick="getTxt()" value="Add Comments" class="button default bt-large"/> 
       </td> 

       </tr> 

       </table> 

在哪一行1是列跨度和行2中有三列,其中2列是顯示無當第一行隱藏列的一個可見自動延伸請任何溶液

+0

你能給我們一個http://jsfiddle.net演示嗎?謝謝! –

回答

3

您已經有一個div來顯示消息。擺脫3列,只使用一個列。顯示/隱藏列在瀏覽器中不起作用。對於圖像和按鈕,只需提及display:inline-block。

2

使用visibility: hidden;代替display:none;這將保留空間的內容,但不可見。

+0

好主意thanx ..... –