>> Click here Download complete html Source code <<

The screenshot is as follows :

Scroll the middle mouse button to read Json The data page displays the content of the web page , pivotal Javascript as follows :

 <script type="text/javascript">
<!--//
function $(id){return document.getElementById(id);} // Definition acquisition ID Methods
function GotoPage(num){ // Jump page
Page = num;
OutputHtml();
}
var PageSize = 9; // Number of pages
var Page = 1; // The current page number
function OutputHtml(){
var obj = eval(siteList); // obtain JSON
var sites = obj.sites;
// Get the total number of pages
var Pages = Math.floor((sites.length - 1) / PageSize) + 1;
if(Page < 1)Page = 1; // If the current page number is less than 1
if(Page > Pages)Page = Pages; // If the current page number is greater than the total number
var Temp = "";
var BeginNO = (Page - 1) * PageSize + 1; // Numbered starting
var EndNO = Page * PageSize; // End number
if(EndNO > sites.length) EndNO = sites.length;
if(EndNO == 0) BeginNO = 0;
if(!(Page <= Pages)) Page = Pages;
$("total").innerHTML = "Total:<strong class='f90'>" + sites.length + "</strong>&nbsp;&nbsp;Show:<strong class='f90'>" + BeginNO + "-" + EndNO + "</strong>";
// Pagination
if(Page > 1 && Page !== 1){Temp ="<a href='javascript:void(0)' onclick='GotoPage(1)'>&lt;&lt;Index</a> <a href='javascript:void(0)' onclick='GotoPage(" + (Page - 1) + ")'>Previous</a>&nbsp;"}else{Temp = "&lt;&lt;Index Previous&nbsp;"};
// The perfect flip list
var PageFrontSum = 3; // The number of pages displayed in front of the page
var PageBackSum = 3; // When the number of pages is displayed
var PageFront = PageFrontSum - (Page - 1);
var PageBack = PageBackSum - (Pages - Page);
if(PageFront > 0 && PageBack < 0)PageBackSum += PageFront; // Less in the front and more in the back , The remaining space in the front is for the back
if(PageBack > 0 && PageFront < 0)PageFrontSum += PageBack; // Less in the back and more in the front , After the remaining space to the front
var PageFrontBegin = Page - PageFrontSum;
if(PageFrontBegin < 1)PageFrontBegin = 1;
var PageFrontEnd = Page + PageBackSum;
if(PageFrontEnd > Pages)PageFrontEnd = Pages;
if(PageFrontBegin != 1) Temp += '<a href="javascript:void(0)" onclick="GotoPage(' + (Page - 10) + ')" title=" front 10 page ">..</a>';
for(var i = PageFrontBegin;i < Page;i ++){
Temp += " <a href='javascript:void(0)' onclick='GotoPage(" + i + ")'>" + i + "</a>";
}
Temp += " <strong class='f90'>" + Page + "</strong>";
for(var i = Page + 1;i <= PageFrontEnd;i ++){
Temp += " <a href='javascript:void(0)' onclick='GotoPage(" + i + ")'>" + i + "</a>";
}
if(PageFrontEnd != Pages) Temp += " <a href='javascript:void(0)' onclick='GotoPage(" + (Page + 10) + ")' title=' after 10 page '>..</a>";
if(Page != Pages){Temp += "&nbsp;&nbsp;<a href='javascript:void(0)' onclick='GotoPage(" + (Page + 1) + ");'>Next</a> <a href='javascript:void(0)' onclick='GotoPage(" + Pages + ")'>Last&gt;&gt;</a>"}else{Temp += "&nbsp;&nbsp;Next Last&gt;&gt;"}
$("pagelist").innerHTML = Temp;
// Output data
if(EndNO == 0){ // If it is empty
$("content").innerHTML += "<h1>No Images</h1>";
return;
}
var html = "";
for(var i = BeginNO - 1;i < EndNO;i ++){
html += "<div class='entry'>";
html += "<a href='" +sites[i].Url+ "' rel='bookmark' title=" +sites[i].Name+ ">";
html += "<img src='" +sites[i].Pic+ "' width='200' height='170' />";
html += "<p class='url'><span>" +sites[i].Name+ "</span></p></a>";
html += "</div>";
}
$("content").innerHTML = html;
clickShow(); // Call the mouse click event
// Turn the page with the left and right keys on the keyboard
document.onkeydown=function(e){
var theEvent = window.event || e;
var code = theEvent.keyCode || theEvent.which;
if(code==37){
if(Page > 1 && Page !== 1){
GotoPage(Page - 1);
}
}
if(code==39){
if(Page != Pages){
GotoPage(Page + 1);
}
}
}
// The mouse wheel turns the page
function handle(delta){
if (delta > 0){
if(Page > 1 && Page !== 1){
GotoPage(Page - 1);
}
}
else{
if(Page != Pages){
GotoPage(Page + 1);
}
}
}
function wheel(event){
var delta = 0;
if (!event) /* For IE. */
event = window.event;
if (event.wheelDelta) { /* IE perhaps Opera. */
delta = event.wheelDelta / 120;
/** stay Opera9 in , Event handling is different from IE
*/
if (window.opera)
delta = -delta;
} else if (event.detail) { /** compatible Mozilla. */
/** In Mozilla, sign of delta is different than in IE.
* Also, delta is multiple of 3.
*/
delta = -event.detail / 3;
}
/** If The increment is not equal to 0 The trigger
* The main function is to test the roller up or down
*/
if (delta)
handle(delta);
}
/** initialization */
if (window.addEventListener)
/** Mozilla Based on the DOM The wheel event **/
window.addEventListener("DOMMouseScroll", wheel, false);
/** IE/Opera. */
window.onmousewheel = document.onmousewheel = wheel;
}
// Get the link address and website name
function showLink(source){
var siteUrl = $("siteurl");
var siteName = $("sitename");
var description = $("description");
if(source.getAttribute("rel") == "bookmark"){
var url = source.getAttribute("href");
var title = source.getAttribute("title");
siteUrl.innerHTML = "<a href='" + url + "' target='_blank'>"+ url +"</a>";
siteName.innerHTML = title;
}
}
// Mouse click event
function clickShow(){
var links = $("content").getElementsByTagName("a");
for(var i=0; i<links.length; i++){
var url = links[i].getAttribute("href");
var title = links[i].getAttribute("title");
links[i].onclick = function(){
showLink(this);
return false;
}
}
}
//-->
</script>

Javascript Examples and techniques (6)— Scroll the middle mouse button to read Json Data pagination shows more related articles about the content of the web page

  1. JavaScript Examples and techniques (10)— Calculator example 2

    >> Click here to download the complete html Source code << This is a screenshot : utilize Javascript and html Another example of a calculator implemented , The core code is as follows : <script language=" ...

  2. JavaScript Examples and techniques (9)— Calculator example 1

    >> Click here to download the complete html Source code << This is a screenshot : utilize Javascript and html Implementation of a calculator example , The core code is as follows : <script language="J ...

  3. Javascript Examples and techniques (7)— Set and get the cursor position of text box and text field ( compatible IE and Chrome,Firefox)

    >> Click here to download the complete html Source code << The screenshot is as follows : This example describes how to use Javascript To control and access text boxes / The mouse cursor position in the text field , The following code is compatible IE and Chrome,Firefox ...

  4. JavaScript Examples and techniques (14)— Dynamically change the background color

    >> Click here to download the complete html Source code << This is a screenshot : Page background color changes over time , The core code is as follows : <SCRIPT LANGUAGE="JavaScript"& ...

  5. JavaScript Examples and techniques (13)— Calculate the time spent on a web page

    >> Click here to download the complete html Source code << This is a screenshot : The core code is as follows : <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- ...

  6. JavaScript Examples and techniques (12)— Calculate constellations and zodiacs

    >> Click here to download the complete html Source code << This is a screenshot : The core code is as follows : <SCRIPT LANGUAGE="JavaScript"> <!-- ...

  7. Javascript Examples and techniques (8)— Calculate the remaining days of the month

    >> Click here to download the complete html Source code << The screenshot is as follows : utilize Javascript Calculate the remaining days of the current month on the web page , The corresponding codes are as follows : <script language="J ...

  8. JavaScript Examples and techniques (11)— Calculator example 3

    >> Click here to download the complete html Source code << The interface is as follows Insert the following code into <body></body> in <FORM NAME="Calc" ...

  9. php Paging example to read mysql Data paging display

    The following code is PHP Paging cases , The test passed , Mainly PHP+mysql Implement paging , The code comes from Baidu space , If you are interested, you can find out PHP How to paginate ? <?php $link = mysql_connect(&q ...

Random recommendation

  1. [Everyday Mathematics]20150301

    set up $f(x)$ stay $[-1,1]$ There are derivatives of any order on the surface , $f^{(n)}(0)=0$, among $n$ Any positive integer , And there are $C>0$, $$\bex |f^{(n)}(x)|\leq C^ ...

  2. swing Reprint of reading notes

    (swing Reading notes )Swing Look And Feel(1) http://blog.csdn.net/cszhao1980/article/details/7343524 (swing Reading notes ...

  3. There is no Action mapped for action name XXX. - [unknown location]

    I spent a lot of time on this issue today , The reason is the lack of  struts2-json-plugin-2.3.1.2.jar package Of course , Sometimes it may be the lack of other bags , Add this package to lib After the folder is refreshed ,clean once , because ...

  4. I am right. Laravel ThinkPHP Yii symfony2 CI cakephp View of the

    This is my real experience , Trying to use Laravel.ThinkPHP.Yii.symfony2.CI.cakephp.Yii2 The real idea after that (default7#zbphp.com). 1)ThinkPHP ...

  5. Go Language -- Basic grammar notes

    ### Changed jobs , I haven't added a new article for a long time , Originally, I wanted to update to github Upper , Think about it in the blog , I feel that the previous articles are not very careful , It's just a record of problem handling , It's better to add some new notes in the future ### primary coverage 2.1 ...

  6. mybatis course 5( Delay loading and caching )

    Connections In a relational database , Tables are rarely independent of each other . So in the actual development process, we will encounter many complex relationships . Here we analyze the download mybatis How to deal with these relationships 1 Yes 1 Relationship We have a staff list (T ...

  7. http put post Request differentiation

    1.RESTful API REST: Representational State Transfer url Corresponding to a resource on the server ,e.g. data , Pictures, etc , therefore url There are only nouns in it , adopt HTTP dynamic ...

  8. ELk The use of kibana Show visit IP Map

    Reference documents :http://blog.51cto.com/ls40905250/1915280 https://blog.csdn.net/zsjwish/article/details/79792212 ...

  9. HDU-3631 Shortest Path (floyd)

    Description When YY was a boy and LMY was a girl, they trained for NOI (National Olympiad in Informa ...

  10. [Leetcode] valid palindrome Verify palindrome

    Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...