如果有人能给我一个关于如何解析这种表格并以特定顺序显示结果的提示,我将不胜感激。
所以我拥有的那段html是
<table name="maintable" cellspacing="2" cellpadding="3" border="0" id="grid_block" width="100%" class="csm">
<tr class="shade" style="font-weight: bold">
<td width="30%">Name</td>
<td width="70%">NameOne</td>
</tr>
<tr class="shade" style="font-weight: bold">
<td>Date</td>
<td>2012-09-30</td>
</tr>
</table>
<br>
<table name="maintable" cellspacing=2 cellpadding=3 border=0 id="grid_block" width="100%" class="csm">
<tr>
<td colspan="12" align="center" bgcolor="#90ee90"><b>In Stock</b></td>
</tr>
<tr onmouseover="this.className = 'rowselected';" onmouseout="this.className = 'shade';">
<td class="greenshade"><b>Color/Size</b></td>
<td align="center" class="greenshade"><b>OO</b></td>
<td align="center" class="greenshade"><b>0</b></td>
<td align="center" class="greenshade"><b>2</b></td>
<td align="center" class="greenshade"><b>4</b></td>
<td align="center" class="greenshade"><b>6</b></td>
<td align="center" class="greenshade"><b>8</b></td>
<td align="center" class="greenshade"><b>10</b></td>
<td align="center" class="greenshade"><b>12</b></td>
<td align="center" class="greenshade"><b>14</b></td>
<td align="center" class="greenshade"><b>16</b></td>
<td align="center" class="greenshade"><b>18</b></td>
</tr>
<tr onmouseover="this.className = 'rowselected';" onmouseout="this.className = 'shade';">
<td width='30%' ><b>black</b></td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
</tr>
<tr onmouseover="this.className = 'rowselected';" onmouseout="this.className = 'shade';">
<td width='30%' ><b>nude</b></td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
<td align="Center">-</td>
</tr>
问题是我需要解析这个表并以这种形式输出:
;nameOne;黑色;OO;-;
;nameOne;黑色;0;-;
;nameOne;黑色;2;-;
等等
所以基本上 - 名称(来自第一个表),颜色,尺寸,数量;适用于每种颜色和尺寸。
在过去的两天里,我一直在努力做到这一点,但到目前为止还没有运气,所以我将不胜感激!谢谢!