Php 损坏的嵌套表
我有一个隐藏的嵌套表。单击黄色箭头时,嵌套表将显示/隐藏。问题是我的桌排坏了 正如上图所示,另一个表行已被破坏。这有什么问题Php 损坏的嵌套表,php,jquery,mysql,html-table,Php,Jquery,Mysql,Html Table,我有一个隐藏的嵌套表。单击黄色箭头时,嵌套表将显示/隐藏。问题是我的桌排坏了 正如上图所示,另一个表行已被破坏。这有什么问题 <?php echo'<table id="tfhover" cellspacing="0" class="tablesorter"> <thead> <tr> <th style="display:none;"></
<?php
echo'<table id="tfhover" cellspacing="0" class="tablesorter">
<thead>
<tr>
<th style="display:none;"></th>
</tr>
</thead>';
echo'<tbody>';
$i=1;
while($row = $result->fetch_assoc()){
echo'<tr>
<td align="center" id="none">';
if (empty($row['qtysum'])){
echo '<a href="javascript:void(0)"></a></td>';
} else {
echo '<a onclick="toggleTable(this);" data-counter="'.$rowid.'" href="#"><img src="images/arrow_right.png" border="0" width="15" height="15" title="Show List of '.$row["item_name"].'"></a></td>';
}
echo'<td>'.$i++.'</td>
</tr>';
echo'<tr>';
echo'<table id="loginTable'.$rowid.'" border="1" align="center" style="display:none">
<thead>
<tr>
<th></th>
</tr>
</thead>';
echo'<tbody>';
$i=1;
while($row = $result1->fetch_assoc()){
echo'<tr>
<td>'.$i++.'</td>
</tr>';
}
echo "</tbody></table></tr>";
}
}
echo "</tbody></table>";
?>
这是我的显示/隐藏表脚本
<script>
function toggleTable(link) {
var elem=document.getElementById("loginTable" + link.getAttribute('data-counter'));
var hide = elem.style.display =="none";
if (hide) {
elem.style.display="table";
} else {
elem.style.display="none";
}
return false;
}
</script>
If has看起来在创建子表之前没有打开父表,并且关闭标记也丢失了 使用注释对进行更改的零件进行注释
查看页面源代码并发布HTML标记,该标记由PHP代码构建,呈现方式与预期不同。这将使我们和你更容易发现问题。我尝试了你的建议。我用你回答结果的图像更新了我的问题。
<?php
echo'<table id="tfhover" cellspacing="0" class="tablesorter">
<thead>
<tr>
<th style="display:none;"></th>
</tr>
</thead>';
echo'<tbody>';
$i=1;
while($row = $result->fetch_assoc()){
echo'<tr>
<td align="center" id="none">';
if (empty($row['qtysum'])){
echo '<a href="javascript:void(0)"></a></td>';
} else {
echo '<a onclick="toggleTable(this);" data-counter="'.$rowid.'" href="#"><img src="images/arrow_right.png" border="0" width="15" height="15" title="Show List of '.$row["item_name"].'"></a></td>';
}
echo'<td>'.$i++.'</td>
</tr>';
echo'<tr><td>'; <!-- there was no td opened here -->
echo'<table id="loginTable'.$rowid.'" border="1" align="center" style="display:none">
<thead>
<tr>
<th></th>
</tr>
</thead>';
echo'<tbody>';
$i=1;
while($row = $result1->fetch_assoc()){
echo'<tr>
<td>'.$i++.'</td>
</tr>';
}
echo "</tbody></table>";
<!-- opened tr,td are closed here -->
echo "</td></tr>"
}
}
echo "</tbody></table>";
?>