function chkall(input1)
{
var objForm = document.getElementById("contentForm");
var objLen = objForm.length;
for (var iCount = 0; iCount < objLen; iCount++){
if (input1.checked == true){
if (objForm.elements[iCount].type == "checkbox"){
objForm.elements[iCount].checked = true;
}
}else{
if (objForm.elements[iCount].type == "checkbox"){
objForm.elements[iCount].checked = false;
}
}
}
}
<form id="contentForm" action="${contextPath}/background/manageNewsAction.do">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--分页处理开始,将action的路径替换即可, 拿到当前page的内容,迭代输出开始 -->
<c:forEach var="articleInfo" items="${page.contentBulk}">
<tr>
<td width="7%" align="center">
<input type="checkbox" name="ids" value='${articleInfo.id}' />
</td>
<td width="14%" align="center">
${articleInfo.type.typeName}
</td>
<td width="47%" align="center">
${articleInfo.title}
</td>
<td width="10%" align="center">
${articleInfo.author.username}
</td>
<td width="5%" align="center">
${articleInfo.status}
</td>
<td width="11%" align="center">
${articleInfo.issueDate}
</td>
<td width="6%" align="center">
<input type="button" name="editnews" value="编辑"
οnclick="updateClick(${articleInfo.id})" />
</td>
</tr>
</c:forEach>
<!--迭代内容输出结束 -->
<!-- 插入新闻 结束 -->
<tr>
<td colspan="10" height="15"
background="${contextPath}/background/img/laji05.gif"
style="background-repeat: repeat-x;background-position: bottom"></td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" name="checkbox" value="checkbox"
οnclick="chkall(this)" />全选
<input type="hidden" name="formFlag" value="3" />
<input type="hidden" name="activeFlag" />
<input type="hidden" name="newsId" />
<input type="hidden" name="method" />
</td>