2012-09-06 140 views
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> 

回答

1

粘贴代码,并固定在这里吧:

http://jsfiddle.net/5nNxB/

你最后<tr>没有一个<td>。添加了正确的colspan

作为一个方面说明,你的代码不是很干净。将整个表格包装在<form>中,而不是在中间随机插入标签。此外,尽量不要用内嵌样式和属性,例如bgcolor

+1

非常感谢!我甚至没有意识到这一点!研究了10分钟,并没有看到它,谢谢! – Alec

+0

很高兴帮助。 :) 这是否回答你的问题? –

+0

是的!非常感谢! – Alec

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标签也被放置不当

+0

你如何修复表格?谢谢。在表单标签 – Alec

+0

代替表。 – elo

+0

但是你的按钮放在桌子的顶部,因为你分配了属性colspan到标签,而不是​​ – elo

相关问题