yunlian0621 阅读(181) 评论(0)

jsp代码:

<c:forEach var="main" items="${mainPage.list }">
	<tr>
		<td><a class="sceneStr_td">${main.sceneStr }</a></td>
		<td class="concern">${main.concernedNumber }</td>
		<td class="noConcern">${main.noConcernedNumber }</td>
		<td class="validateNumber">${main.validateNumber }</td>
		<td>${main.createTime }</td>
		<td>${main.delFlag==0?'允许':'不允许' }</td>
		<td>
                     <a href="${main.url }" target="_blank">二维码链接</a>
		</td>
	</tr>
</c:forEach>
<tr class="count_main">
	<th style="text-align: center;">统计:</th>
	<td class="count_concern">0</td>
	<td class="count_noConcern">0</td>
	<td class="count_validateNumber">0</td>
	<td></td>
	<td></td>
	<td></td>
</tr>

 js代码:

	var main_list_size = $(".main_list_size").val();//获取主单循环大小
	main_list_size = parseInt(main_list_size);
	var count_concern = parseInt(0);
	var count_noConcern = parseInt(0);
	var count_validateNumber = parseInt(0);
	if(main_list_size<=0){
		$(".count_main").hide();//没有数据时,隐藏该行
	}else{
		var concern = $(".concern   noConcern   validateNumber");
		for(var i=0;i<main_list_size;i++){
			count_concern = count_concern+ parseInt($(".concern").eq(i).html());
			count_noConcern = count_noConcern + parseInt($(".noConcern").eq(i).html());
			count_validateNumber = count_validateNumber + parseInt($(".validateNumber").eq(i).html());
		}
		$(".count_concern").html(count_concern);
		$(".count_noConcern").html(count_noConcern);
		$(".count_validateNumber").html(count_validateNumber);
		$(".count_main").show();//有数据时,显示该行
	}

 这样,下面的统计信息就全出来了