多个图片用JS分页?
发布网友
发布时间:2022-05-04 16:49
我来回答
共1个回答
热心网友
时间:2022-05-15 14:24
假设一组图片:Image0,Image1,Image2......Image19
<script language="javascript">
var pageSizes = 5; //分每页5张
var currentPage = parseInt('<%=request("page")%>'); //取得当前页码
var recordCount = 20; //图片数量
if(currentPage<1 || currentPage == NaN){
currentPage = 1;
}
for(var i=0;i<recordCount;i++){
if((currentPage-1)*pageSizes <= i < currentPage*pageSizes){
document.all["Image" + i].style.display = '';
}else{
document.all["Image" + i].style.display = 'none';
}
}
</script>