& lt; ! DOCTYPE html>
<meta HTTP - equiv="content-type" content="text/HTML. Charset=utf-8 "& gt;
Web page special effects of static code page effect & lt;/title>
<style type="text/CSS" & gt;
Li {display: none}
</style>
<body>
Static web page paging effect 01 & lt;/li>
Static web page paging effect 02 & lt;/li>
Effect of static web pages on page 3 & lt;/li>
Effect of static web pages on page 4 & lt;/li>
Effect of static web pages on page 5 & lt;/li>
Effect of static web pages on page 6 & lt;/li>
The effect of static web pages 07 page & lt;/li>
Static web page paging effect 08 & lt;/li>
Effect of static web pages on page 9 & lt;/li>
Effect of static web pages 10 pages & lt;/li>
Effect of static web page 11 pages & lt;/li>
Effect of static web pages 12 pages & lt;/li>
Effect of static web pages on page 13 & lt;/li>
Effect of static web pages on page 14 & lt;/li>
Effect of static web page 15 pages & lt;/li>
Effect of static web page 16 pages & lt;/li>
Effect of static web pages on page 17 & lt;/li>
Effect of static web pages 18 pages & lt;/li>
Effect of static web pages on page 19 & lt;/li>
Effect of static web page 20 pages & lt;/li>
<script language="javascript" & gt;
Var obj, j;
Var page=0;
Var currentPage=0;//the current page
Var listNum=2;//each page shows & lt; Ul> Count
Var PagesLen;//total number of pages
Var PageNum=4;//paging links to connect number (5)
Window. The onl oad=function () {
Obj=document. GetElementById (" box "). The getElementsByTagName (" li ");
J=obj length//the number of li
PagesLen=math.h ceil (j/listNum);//total number of pages
UpPage (0)
}
The function upPage (p) {
CurrentPage=p
//content change
For (var I=0; I & lt; j; I++) {
Obj [I]. Style. The display="none"
}
For (var I=p * listNum; I & lt; (p + 1) * listNum; I++) {
If (obj) [I] obj [I] style. The display="block";
console.log(i);
}
//paging links to transform
Var strS='& lt; A href="https://bbs.csdn.net/topics/#!" "Onclick=" upPage (0) & gt; The homepage & lt;/a> ';//page
Var PageNum_2 PageNum=% 2==0? Math. Ceil (PageNum/2) + 1: math.h ceil (PageNum/2);
Var PageNum_3 PageNum=% 2==0? Math. Ceil (PageNum/2) : math.h ceil (PageNum/2) + 1;
The console. The log (PageNum_2 PageNum_3);
Var strC=", "startPage, endPage;
If (PageNum & gt;={PagesLen)
StartPage=0;
EndPage=PagesLen - 1;
} else if (currentPage & lt; PageNum_2) {
StartPage=0;
EndPage=PagesLen - 1 & gt; PageNum? PageNum: PagesLen - 1;
} else {
StartPage=(currentPage + PageNum_3 & gt;=PagesLen)? PagesLen PageNum - 1: currentPage PageNum_2 + 1;
Var t=startPage PageNum +;
EndPage=(t & gt; PagesLen)? PagesLen - 1: t;
}
The console. The log (startPage, endPage);
For (var I=startPage; I & lt;=endPage; I++) {
If (I==currentPage) strC +='& lt; A href="https://bbs.csdn.net/topics/###" style="color: red; The font - weight: 700;" The onclick="upPage (' + I + ')" & gt; '+ (I + 1) +' & lt;/a> '
The else strC +='& lt; A href="https://bbs.csdn.net/topics/#! '+ (I + 1) +' "onclick=" upPage (' + I + ') "& gt; '+ (I + 1) +' & lt;/a> '
Document. The getElementsByTagName (" title ") [0]. The innerText="+ (I + 1) +";
}
Var strE='& lt; A href="https://bbs.csdn.net/topics/#!" The onclick="upPage (' + (PagesLen - 1) + ')" & gt; Back & lt;/a> ';//back
Var strE2=currentPage + 1 + "/" + PagesLen + "page" + ", "+ j +" article "; Article//*
Document. The getElementById (" page "). The innerHTML=strS + strC + + strE2 strE;
}
</script>