2012-09-06 139 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

相關問題