html tr td colspan
colspan 属性规定单元格可横跨的列数,
第一行的colspan规定其一行所跨越的列数,要与下一行的<td></td>个数一致
if(!empty ($alarmDescArr)) { echo '<table width="80%" border="0" cellspacing="0" class="tableNormal" id=THAlarmCfgid > <tr bgcolor="#0099FF"> <td class="tableTitleL1" colspan="10"><font color="#FFFFFF">告警描述与条件</font></td> </tr> <tr> <td nowrap class="tableSingularLine">告警描述使能</td> <td nowrap class="tableSingularLine">告警描述</td> <td nowrap class="tableSingularLine">告警级别</td> <td nowrap class="tableSingularLine">告警描述延迟时间</td> <td nowrap class="tableSingularLine">告警运行参数</td> <td nowrap class="tableSingularLine">告警运行参数判断条件</td> <td nowrap class="tableSingularLine">告警条件条件值A</td> <td nowrap class="tableSingularLine">告警条件条件值B</td> <td nowrap class="tableSingularLine">添加告警条件</td> <td nowrap class="tableSingularLine">删除告警条件</td> </tr> '; } for($i=0;$i<count($alarmDescArr); $i++) { if ($i%2) { $szClass = "tableEvenLine"; } else { $szClass = "tableSingularLine"; } echo("<tr id=alarmDefine ".$i." >"); // disabled delete alarm if($alarmDescArr[$i]['wd_encblelog'] == 1) $alarmDescEnalbe = "checked"; else $alarmDescEnalbe = ""; // echo $alarmDescArr[$i]['wd_encblelog']; // 告警描述使能 echo("<td nowrap class=".$szClass."> <input name=alarmDescArr[".$i."][wd_encblelog] type=checkbox class=textEnaSty value=1 ".$alarmDescEnalbe." size=10 maxlength=10 disabled></td>"); // 传递wd_id 与 wd_priority // echo("<input name=alarmDescArr[".$i."][wd_id] type=\"hidden\" class=textEnaSty value=\"".$alarmDescArr[$i]['wd_id']."\" >"); // echo("<input name=alarmDescArr[".$i."][wd_priority] type=\"hidden\" class=textEnaSty value=\"".$alarmDescArr[$i]['wd_priority']."\" >"); // 告警描述 echo("<td nowrap class=".$szClass."> <input name=alarmDescArr[".$i."][wd_warndesc] type=text class=textEnaSty value=\"".$alarmDescArr[$i]['wd_warndesc']."\" size=15 maxlength=10 disabled></td>"); // 告警级别 echo("<td nowrap class=".$szClass."> <select name=alarmDescArr[".$i."][wd_level] size=1 class=textEnaSty> <option value=". $alarmDescArr[$i]['wd_level'] ." selected disabled>".$alarmLev[$alarmDescArr[$i]['wd_level']]."</option> </select> </td>"); //告警描述延迟时间 通过OpenNewWindow echo("<td nowrap class=".$szClass."> <input name=alarmDescArr[".$i."][wd_delay] type=text class=textEnaSty value=\"".$alarmDescArr[$i]['wd_delay']."\" size=10 maxlength=10 disabled></td>"); // 运行参数 echo("<td nowrap class=".$szClass."> <input name=alarmDescArr[".$i."][wc_parameters] type=text class=textEnaSty value=\"".$alarmDescArr[$i]['wc_parameters']."\" size=10 maxlength=10 disabled></td>"); // 判断条件 echo("<td nowrap class=".$szClass."> <select name=alarmDescArr[".$i."][wc_conditions] size=1 class=textEnaSty> <option value=". $alarmDescArr[$i]['wc_conditions'] ." selected disabled>".$alarmJdgCon[$alarmDescArr[$i]['wc_conditions']]."</option> </select> </td>"); // 条件值A echo("<td nowrap class=".$szClass."> <input name=alarmDescArr[".$i."][wc_value0] type=text class=textEnaSty value=\"".$alarmDescArr[$i]['wc_value0']."\" size=10 maxlength=10 disabled></td>"); // 条件值B echo("<td nowrap class=".$szClass."> <input name=alarmDescArr[".$i."][wc_value1] type=text class=textEnaSty value=\"".$alarmDescArr[$i]['wc_value1']."\" size=10 maxlength=10 disabled></td>"); // 添加告警条件 echo("<td nowrap class=".$szClass."> <input name=alarmDefine[".$i."]['alarm_delete'] type=button class=inputButtonNormal value='添加' onClick='OpenNewWindow(".$alarmDescArr[$i]['wd_id'].",".$alarmDescArr[$i]['wd_priority'].",".$device_type_id.")' size=50></td>"); // 删除告警描述及相关的告警条件 echo("<td nowrap class=".$szClass."> <input name=alarmDefine[".$i."][con_add] type=button class=inputButtonNormal value='删除' onClick='alarmDelete(".$alarmDescArr[$i]['wd_id'].",".$alarmDescArr[$i]['wd_priority'].",".$device_type_id.",\"".$alarmDescArr[$i]['wc_parameters']."\")'></td>"); echo("</tr>"); } if(!empty ($alarmDescArr)) { echo "</table>"; echo "<p></p>"; }
效果如下: