我有三個陣列,我想垂直排列在HTML表格中。每個數組將從上到下將其數據填充到列中。如何垂直填充數據表?
例如,我有三個數組:
fruit = ['pear', 'apple', 'orange']
veges = ['corn', 'radish', 'lettuce']
meat = ['beef', 'chicken', 'pork']
我想表看起來像這樣:
<table>
<tr>
<td>
pear
</td>
</tr>
<tr>
<td>
corn
</td>
</tr>
<tr>
<td>
beef
</td>
</tr>
<tr>
<td>
apple
</td>
</tr>
<tr>
<td>
radish
</td>
</tr>
<tr>
<td>
chicken
</td>
</tr>
<tr>
<td>
orange
</td>
</tr>
<tr>
<td>
lettuce
</td>
</tr>
<tr>
<td>
pork
</td>
</tr>
</table>
同樣的問題,沒有解決方案(還):http://stackoverflow.com/questions/3669957/transpose-a-html-table – joeytwiddle
和另一個:http://stackoverflow.com/questions/2128663/display-data- in-columns-not-rows-using-ruby-on-rails – joeytwiddle