The JS code is as follows:
Copy code The code is as follows:
/ /Maximum amount of data
var total="100";
//Amount of display per page
var pagesize=10;
//How many pages are there in total
var pagenum=Math.ceil (total/pagesize);
//Generate navigation
function initpage(nowpage){
var pagenav='Up One page';
for(i=1;i<=pagenum;i++){
pagenav += (i==nowpage)?' ' + i + '':'' + i + ' ' ;
}
pagenav += 'Next page';
document.getElementById(' pages').innerHTML=pagenav;
}
//Turn page
function goToPage(page){
var start=(page-1)*pagesize;
var max =page*pagesize;
for(vs=0;vs var ōbj=document.getElementById('item_' + vs);
obj.style.display="none" ;
}
if(max>total)max=total;
for(v=start;v var ōbj=document.getElementById('item_' + v) ;
obj.style.display="block";
}
initpage(page);
}
//Previous page
function up( nowpage){
if(nowpage==1)return false;
if(nowpage>1)goToPage((nowpage-1));
}
//Next page
function down(nowpage){
if(nowpage==pagenum)return false;
if(nowpage}
< ;/scrīpt>
If the data is
.......... .......... .......... ..
........ Then you can display a navigation similar to this:
Previous page 1 2 3 4 Next page
Then click on the page number or the previous and next pages to switch the display.
Time is tight, That’s all. Please analyze the code yourself. If you don’t understand, please leave a message
http://www.bkjia.com/PHPjc/318995.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318995.htmlTechArticleJS code is as follows: Copy the code as follows: scrīptlanguage="javascrīpt" //Maximum data amount vartotal="100" ; //The display amount of each page varpagesize=10; //How many pages are there in total varpagenum=Math....