gpt4 book ai didi

php - 规则=行在 PHP 中不起作用

转载 作者:行者123 更新时间:2023-11-28 10:48:54 25 4
gpt4 key购买 nike

大家好 :) 我试图在表格的每一行之后制作行,它在 HTML 中有效,在我将其放入 PHP 中后它不起作用 :(

<div id="table">
<table width="100%" border="0" rules="rows">
<tr class="bb">
<td><div id="tdheight">asdasd</div></td>
<td>asdasd</td>
<td>asdasdasd</td>
<td>asdasdad</td>
<td>asdadasda</td>
</tr>
<tr class="bb">
<td><div id="tdheight">asdasd</div></td>
<td>dasdasdasd</td>
<td>asdasdas</td>
<td>asdasdasd</td>
<td>asdasdasd</td>
</tr>
<tr class="bb">
<td><div id="tdheight">asdasd</div></td>
<td>asdasdasd</td>
<td>asdasdasd</td>
<td>asdasdasd</td>
<td>adasdasdasd</td>
</tr>
</table>
</div>

这是我的 HTML 代码,这是我的 PHP 代码,其中 rules=rows 不起作用

echo '<div id="table" align="center">';
echo '<table width="100%" border="0" rules="rows">';
echo '<tr class="bb">';
echo '<td><div id="tdheight">asdasd</div></td>';
echo '<td>asdasd</td>';
echo '<td>asdasd</td>';
echo '<td>asdasd</td>';
echo '<td>asdasd</td>';
echo '</tr>';

这就是我的全部代码:)

<!DOCTYPE html>
<html>
<head>

<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body onload="startTime()">
<div id="clock">
<!--<div id="txt"></div>-->
</div>
<!--<div id="table">
<table width="100%" border="0" rules="rows">
<tr class="bb">
<td><div id="tdheight">asdasd</div></td>
<td>asdasd</td>
<td>asdasdasd</td>
<td>asdasdad</td>
<td>asdadasda</td>
</tr>
<tr class="bb">
<td><div id="tdheight">asdasd</div></td>
<td>dasdasdasd</td>
<td>asdasdas</td>
<td>asdasdasd</td>
<td>asdasdasd</td>
</tr>
<tr class="bb">
<td><div id="tdheight">asdasd</div></td>
<td>asdasdasd</td>
<td>asdasdasd</td>
<td>asdasdasd</td>
<td>adasdasdasd</td>
</tr>
<tr class="bb">
<td><div id="tdheight">asdasd</div></td>
<td>asdasdasd</td>
<td>sdasdasda</td>
<td>dasdasda</td>
<td>sdasdasda</td>
</tr>
<tr class="bb">
<td><div id="tdheight">asdasd</div></td>
<td>asdasdasd</td>
<td>asdasda</td>
<td>dadasdad</td>
<td>asdadasd</td>
</tr>
</table>
</div>-->
<?php
for($i=0;$i<=10;$i++)

{
echo '<html><body><div id="table" align="center">';
echo '<table width="100%" border="0" rules="rows">';
echo '<tr class="bb">';
echo '<td><div id="tdheight">asdasd</div></td>';
echo '<td>asdasd</td>';
echo '<td>asdasd</td>';
echo '<td>asdasd</td>';
echo '<td>asdasd</td>';
echo '</tr>';
}

?>
</table>
</body>
</body>
</html>

最佳答案

每次 for 循环时您都在创建一个表。

你应该有这样的东西:

<?php
echo '<html><body><div id="table" align="center">';
echo '<table width="100%" border="0" rules="rows">';
for($i=0;$i<=10;$i++)
{
echo '<tr class="bb">';
echo '<td><div class="tdheight">asdasd</div></td>';
echo '<td>asdasd</td>';
echo '<td>asdasd</td>';
echo '<td>asdasd</td>';
echo '<td>asdasd</td>';
echo '</tr>';
}

?>
</table>
</body>
</body>
</html>

您还应该将 id 属性更改为 class one,因为它将是具有相同 id 的多个元素

关于php - 规则=行在 PHP 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22861371/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com