我在 PHP 中有这张表:
echo "<table style='border-style:none;'>";
echo "<tr>";
if (!$goon) {
echo "<td colspan=2 style='border-style:none; text-align:center;'>You have ".$_GET['Tries']." tries to guess my word.</td>";
echo "</tr><tr>";
echo "<td colspan=2 style='border-style:none; text-align:center;'>";
echo "<select id='bet' size='1' style='width:150px;'>";
echo "<option value='0'>Bet";
for ($i=0; $i<=5000; $i+=100) {
echo "<option value='".$i."'";
if ($i == $_GET['Bet'] && $_GET['Bet'] != 0) {
echo " selected='selected'";
}
echo ">".$i."</option>";
}
echo "</select>";
echo "</td>";
echo "</tr><tr>";
echo "<td id='letters' colspan=2 style='border-style:none; color:white; text-align:center; font-size:14px;'>Letters guessed - ".$_GET['Letters']."</td>";
echo "</tr><tr>";
echo "<td colspan=2 style='border-style:none; text-align:center;'>";
echo "<table style='border-style:none;'>";
echo "<tr>";
$l = count($ans);
for ($i=0; $i<$l; $i++) {
echo "<td style='border-style:none;'><input style='width:30px;' id='w".$i."' type='text' value='".$ans[$i]."' /></td>";
}
echo "</tr>";
echo "</table></td>";
echo "</tr><tr>";
?>
<td colspan=2 style='border-style:none; text-align:center;'><input type='button' value='Guess' onClick='hangman("<?php echo $_GET['Word']; ?>",<?php echo $_GET['Tries']; ?>);' /></td>
<?php
echo "</tr><tr>";
}
echo "<td colspan=2 style='border-style:none; color:white; text-align:center; font-size:14px;'>".$msg."</td>";
echo "</tr>";
echo "</table>";
而数组$ans
的值是 c,o,m,e,t。当表格显示时,TD 不应该用彗星填充吗?由于某种原因,它们是空白的。