0

I have a problem which is hard to explain I hope you will understand and help me, I have a table which produce rows dynamically, when a row is pressed it shows a page containing some information, the problem is that when I press on the row and the info page is shown the columns width is changed and the entire table shifts (all the widths). I have noticed that it happens after the info page is loaded but can't figure out why...

CODE: this is where I post the table:

echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" align=\"center\" class=\"result_table\" id=\"result_table\">

<tr align=\"right\" bgcolor=\"red\">
<th bgcolor=\"#cccccc\" align=\"right\" >עיר</th>
<th bgcolor=\"#cccccc\" >רחוב</th>
<th bgcolor=\"#cccccc\" >מספר בית</th>
<th bgcolor=\"#cccccc\" >מחיר</th>
</tr>"; 
foreach($types as $data){               
echo $data['id'];
echo "<tr onClick=\"waiting_for_post(".$data['id'].");\" 
class=\"search_row\">";
echo "<td align=\"right\" width=\"25%\">";
echo $data['city'];
    echo "</td>";
echo "<td align=\"right\">";
echo $data['street'];
echo "</td>";
echo "<td align=\"right\">";
echo $data['house'];
    echo "</td>";
echo "<td align=\"right\">";
echo $data['price'];
echo "</td></tr>";
echo "<tr class=\"info_row\" style=\"width:100%\"><td colspan=\"4\"><div id=\"div_num_".$data['id']."\" style=\"height:0px\" ></div></td></tr>";

function waiting_for_post(apart_id){
var div = document.getElementById("div_num_"+apart_id)
var xmlhttp = createXmlHttpRequestObject();

xmlhttp.onreadystatechange=function()
{
   if (xmlhttp.readyState==4 && xmlhttp.status==200)
   {

     var responseText = xmlhttp.responseText;

     div.innerHTML = responseText;
        div.style.visibility = 'visible';
        div.style.height= "225px";
        div.style.width="100%";
   }
}
xmlhttp.open("GET","publish_data.php?id="+apart_id,true);
xmlhttp.send(); 

}
4

1 回答 1

1

列的宽度会随着内容的变化而变化,因为你设置了“width:100%”,使用固定宽度可能会解决问题,并尝试估计最大宽度。

于 2013-04-18T08:44:57.473 回答