论坛首页 Web前端技术论坛

名字相同的合并单元格

浏览 3820 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (3) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-05-01  
遍历list,有属性name,filmdate,将名字和日期相同的合并单元格
<logic:present name="list">
				<table border="1" id="filmTable">
					<logic:iterate id="list" name="list">
					<tr>
							
							<td >
							<bean:write name="list" property="name" />
							</td>
							<td>
							<bean:write name="list" property="filmdate" />
							</td>
							<td>
							<bean:write name="list" property="filmtime" />
							</td>
							<td>
							<bean:write name="list" property="hallid" />
							</td>
							<td>
							<a href="#" onclick="fixTicket('<bean:write name='list' property='hallid' />','<bean:write name='list' property='filmdate' />')">订票</a>
							</td>
							</tr>
							</logic:iterate>
				</table>
		</logic:present>


js代码:
function reload(){
		var table = document.getElementById("filmTable");
		for(i=0;i<table.rows.length-1;i++){
			for(j=i+1;j<table.rows.length;j++){
				if(table.rows[i].cells[0].innerHTML==table.rows[j].cells[0].innerHTML){
					table.rows[j].deleteCell(0);
					table.rows[i].cells[0].rowSpan++;
					if(table.rows[i].cells[1].innerHTML==table.rows[j].cells[0].innerHTML){
						table.rows[j].deleteCell(0);
						table.rows[i].cells[1].rowSpan++;
					}
				}
			}
		}
	}
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics