底部表格排到最前面

时间:2012-09-06 05:37:05

标签: html html-table

我有以下表格代码,每行包含一个表单。我的问题是,输入和提交的底行将位于顶部表行的顶部。我无法弄清楚为什么。有人可以请求帮助并解释为什么最底线排在最前面?

<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>

2 个答案:

答案 0 :(得分:1)

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

http://jsfiddle.net/5nNxB/

您的上一个<tr>没有<td>。添加右侧colspan

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

答案 1 :(得分: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标记也放置错误