1

我有下表代码,每一行都包含一个表单。我的问题是,输入和提交所在的底行将位于顶部表格行的顶部。我不知道为什么。有人可以帮忙解释一下为什么底行到最上面吗?

<table id="bet_table" width=800px cellspacing=0 cellpadding=1 border-width=1px>
    <tr bgcolor="BF1919" style="color:#fff; font-weight:bold;">
        <td><center>Time</center></td>
        <td><center>Game #</center></td>
        <td><center>Teams</center></td>
        <td><center>Run Line</center></td>
        <td><center>Money Line</center></td>
        <td><center>Total Runs</center></td>
    </tr>
    <tr bgcolor="#F0F0F0">
        <td colspan=6><center><strong>August 28, 2012</strong></center></td>
    </tr>
    <tr bgcolor="#fff">
        <form action="mlb.php?action=update&gameid=" method="post" />
        <td width="130px"><center><input type="text" size="4" name="time" value="7:00" />
        <select name="ampm">
            <option value="AM">A.M.
            <option value="PM">P.M.
        </select></center></td>
        <td width="60px"><center>306</center></td>
        <td>Los Angeles Dodgers<br />Los Angeles Angels</td>
        <td width="150px"><center>                          
        <select name="runline1frac">
            <option value="-1/2">-1&frac12;
            <option value="+1/2">+1&frac12;
        </select> &nbsp; <input type="text" size="4" name="runline1value" value="+120" /><br />
        <select name="runline2frac">
            <option value="-1/2">-1&frac12;
            <option value="+1/2">+1&frac12;
        </select> &nbsp; <input type="text" size="4" name="runline2value" value="-182" /></center></td>
        <td width="80px"><center><input type="text" size="4" name="moneyline1value" value="-132" /><br /><input type="text" size="4" name="moneyline2value" value="+132" /></center></td>
        <td align=right>Total Runs: <input type="text" size="3" name="totalruns" value="6" /> &nbsp; OV &nbsp; <input type="text" size="4" name="totalrunsOvalue" value="-178" /><br />UN &nbsp; <input type="text" size="4" name="totalrunsUvalue" value="+123" /></td>
    </tr>
    <tr colspan=6>
        <center>
            <input type="submit" value="Update" />
            </form>
        </center>
    </tr>
</table>
4

2 回答 2

1

粘贴您的代码并在此处修复:

http://jsfiddle.net/5nNxB/

您的最后一个<tr>没有<td>. 用右边添加它colspan

作为旁注,您的代码不是很干净。将整个表格包裹起来,<form>而不是在中间随机插入标签。另外,尽量不要使用内联样式和属性等bgcolor

于 2012-09-06T05:42:48.870 回答
0

你的代码底部:

<tr colspan=6>
    <center>
       <input type="submit" value="Update" />
       </form>
    </center>
</tr>

应该:

<tr>
    <td colspan=6>
        <center>
           <input type="submit" value="Update" />
           </form>
        </center>
    </td>
</tr>

标签form也放置不正确

于 2012-09-06T05:50:22.380 回答