<script type="text/javascript">
checkedIds="";//翻页保存选中的id
function changeIds(){
var oneches=document.getElementsByClassName("dfinput1");
console.log(oneches)
for(var i=0;i<oneches.length;i++){
if(oneches[i].checked==true){
//避免重复累计id (不含该id时进行累加)
if(checkedIds.indexOf(oneches[i].value)==-1){
checkedIds=checkedIds+oneches[i].value+",";
}
}
if(oneches[i].checked==false){
//取消复选框时 含有该id时将id从全局变量中去除
if(checkedIds.indexOf(oneches[i].value)!=-1){
checkedIds=checkedIds.replace((oneches[i].value+","),"");
}
}
}
console.log(checkedIds)
}
function getChecked(){
var oneches=document.getElementsByClassName("dfinput1");
for(var i=0;i<oneches.length;i++){
//全局变量中含有id,则该复选框选中
if(checkedIds.indexOf(oneches[i].value)!=-1){
oneches[i].checked=true;
}
}
}
</script>
<thead>
<tr>
<th>课程编号</th>
<th>课程名称</th>
<th><input type="checkbox" class="dfinput-all">全选</th>
</tr>
</thead>
<tbody>
<s:iterator value="pageResult1.data">
<tr>
<td>${curriculumId}</td>
<td>${courseName}</td>
<td><input name="curriculumId" id="curriculumId_${curriculumId}" type="checkbox" class="dfinput1" value="${curriculumId}" onclick="changeIds()"></td>
</tr>
</s:iterator>
</tbody>
<div class="pagin">
<div class="message">共<i class="blue">${pageResult1.total}</i>条记录 <i class="blue">${pageResult1.totalPage}</i>页, 当前显示第 <i class="blue">${pageResult1.page}</i>页</div>
<ul class="paginList">
<c:choose>
<c:when test="${pageResult1.isFirst==true}"><li class="paginItem current"><a href="javascript:;">首页</a></li></c:when>
<c:otherwise>
<li class="paginItem"><a href="javascript:first()" target="rightFrame" onclick="getChecked()">首页 </a></li>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${pageResult1.isFirst==true}"><li class="paginItem current"><a href="javascript:;">上一页</a></li></c:when>
<c:otherwise>
<li class="paginItem"><a href="javascript:previous()" target="rightFrame" onclick="getChecked()">上一页 </a></li>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${pageResult1.hasNext==true}">
<li class="paginItem"><a href="javascript:next()" target="rightFrame" onclick="getChecked()">下一页 </a></li>
</c:when>
<c:otherwise><li class="paginItem current"><a href="javascript:;">下一页</a></li></c:otherwise>
</c:choose>
<c:choose>
<c:when test="${pageResult1.isLast==true}"><li class="paginItem current"><a href="javascript:;">尾页</a></li></c:when>
<c:otherwise>
<li class="paginItem"><a href="javascript:last()" target="rightFrame" onclick="getChecked()">尾页 </a></li>
</c:otherwise>
</c:choose>
<li class="paginItem-page">
跳转到:
<input name="textfield" type="text" size="4" class="page-input" id="textfield" onchange="change()" onclick="getChecked()"/> 页
<input type="hidden" id="totalPage" value="${pageResult1.totalPage}"/>
</li>
</ul>
哪里出了问题,第一页勾选,到了第二页,第一页的值就没了,怎么解决,帮帮忙吧,十分感谢