Home Web Front-end JS Tutorial js paging code with switching effect_javascript skills

js paging code with switching effect_javascript skills

May 16, 2016 pm 06:52 PM
js

Loading will take some time, please wait a moment.

<!-- 
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ 
/** 
* 用js分页显示ul/ol的列表 
* 
* 这里的演示设置了自动滚动 
* 
* PHP versions 4 and 5 
* 
* LICENSE: This source file is subject to version 3.0 of the PHP license 
* that is available through the world-wide-web at the following URI: 
* <a rel="nofollow" href="http://www.php.net/license/3_0.txt." target="_blank">http://www.php.net/license/3_0.txt.</a> If you did not receive a copy of 
* the PHP License and are unable to obtain it through the web, please 
* send a note to license@php.net so we can mail you a copy immediately. 
* 
* @package GCCMS 
* @author Yi Bo <etng2004@gmail.com> 
* @copyright 2000-2005 GCSOFT.COM & ETNG.NET 
* @license <a rel="nofollow" href="http://www.php.net/license/3_0.txt" target="_blank">http://www.php.net/license/3_0.txt</a> PHP License 3.0 
* @version SVN: $Id: page.html 21 2006-01-22 09:35:58Z etng $ 
* @link $HeadURL: svn://dev.gccms.net/trunk/page.html $ 
* @see 
* @since 
*/ 
--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>无标题文档</title> 
<style type="text/css"> 
<!-- 
/*这里填写自己需要的css定义*/ 
body { width: 760px; padding: 0 0 0 0; margin: 0 auto 0 auto; font-size: 12px; font-family: "Arial", "Helvetica", "sans-serif"; } 
td { font-size: 12px; } 
ul,li,form,p,span { padding: 0 0 0 0; margin: 0 0 0 0; } 
.ctrlPages {COLOR: #f60;cursor:hand;} 
.curPage {COLOR: #f00;cursor:hand;} 
--> 
</style> 
<script language="JavaScript"> 
<!-- 
var ETNGpager = function( srcName, dstName, cntPP, cntPS ) 
{ 
this.srcName= srcName; 
this.dstName= dstName; 
this.curP= 1;//默认当前页为第一页 
this.cntPP= cntPP || 2;//默认每页两条纪录 
this.cntPS= cntPS || 3;//默认每页显示5个分页上下文 
this.items= []; 
this.showPNP= true;/*显示上下页链接*/ 
this.showType= true;/*滑动分页*/ 
this.result= {pagedata:[],pagebar:&#39;&#39;,limit:[0,0],report:&#39;&#39;}; 
this.parse();/*总纪录数*/ 
} 
ETNGpager.prototype.page = function (){ 
this.cntP= Math.ceil(this.cntR/this.cntPP);/*总页数*/ 
this.cntS= Math.ceil(this.cntP/this.cntPS);/*总段数*/ 
this.curS= Math.ceil(this.curP/this.cntPS);/*当前段*/ 
this.preP= this.curP -1;/*上一页*/ 
this.nextP= this.curP +1;/*下一页*/ 
this.preS= this.curS -1;/*上一段*/ 
this.nextS= this.curS +1;/*下一段*/ 
this.startR= (this.curP -1)*this.cntPP + 1;/*起始纪录*/ 
this.endR= (this.curP*this.cntPP >this.cntR)?this.cntR:this.curP*this.cntPP;/*结束纪录*/ 
this.result[&#39;pagedata&#39;]=[]; 
if(this.showType){ 
this.perSide= Math.floor(this.cntPS/2); 
this.startP= (this.curP > this.perSide)?(this.curP - this.perSide):1; 
this.endP= (this.startP + this.cntPS)>this.cntP?this.cntP:(this.startP + this.cntPS); 
}else{ 
this.startP= (this.curS-1)*this.cntPS+1; 
this.endP= (this.curS*this.cntPS>this.cntP)?this.cntP:(this.curS*this.cntPS); 
} 
for(var i = this.startP;i<=this.endP;i++){ 
this.result[&#39;pagedata&#39;].push((i==this.curP)?&#39;<span class="curPage">&#39;+i+&#39;</span>&#39;:&#39;<span onclick="page(&#39;+i+&#39;)">&#39;+i+&#39;</span>&#39;); 
} 
if(this.showPNP){ 
if(this.curP>1)this.result[&#39;pagedata&#39;].unshift(&#39;<span onclick="page(&#39;+(this.curP-1)+&#39;)">上一页</span>&#39;); 
if(this.curP<this.cntP)this.result[&#39;pagedata&#39;].push(&#39;<span onclick="page(&#39;+(this.curP+1)+&#39;)">下一页</span>&#39;); 
} 
this.result[&#39;pagebar&#39;]= this.result[&#39;pagedata&#39;].join(&#39; &#39;); 
this.result[&#39;limit&#39;]= [this.startR,this.endR]; 
this.result[&#39;report&#39;]= &#39;共&#39;+this.cntR+&#39;条,当前页&#39;+this.startR+&#39;-&#39;+this.endR+&#39;,&#39;+this.curP+&#39;/&#39;+this.cntP+&#39;页&#39;; 
} 
ETNGpager.prototype.parse = function (){ 
var obj = document.getElementById(this.srcName); 
for(var i = 0;i<obj.childNodes.length;i++){ 
if(obj.childNodes[i].nodeType!=3)this.items[this.items.length]=obj.childNodes[i].innerHTML; 
} 
this.cntR = this.items.length; 
return this.items.length; 
} 
ETNGpager.prototype.create=function(){ 
this.page(); 
document.getElementById(this.dstName).innerHTML=&#39;<li>&#39;+this.items.slice(this.startR-1,this.endR).join(&#39;</li><li>&#39;)+&#39;</li>&#39;; 
document.getElementById(this.dstName).innerHTML+=&#39;<span class="ctrlPages">&#39;+this.result[&#39;pagebar&#39;]+this.result[&#39;report&#39;]+&#39;</span>&#39;; 
} 
//--> 
</script> 
</head> 
<body> 
<ul id="listcontent" style="display:none;"> 
<li><a href=<a rel="nofollow" href="http://tech.sina.com.cn/i/2005-12-08/1204786367.shtml" target="_blank">http://tech.sina.com.cn/i/2005-12-08/1204786367.shtml</a> target=&#39;_blank&#39;>支付宝与六大代理签订协议 </a></li> 
<li><a href=<a rel="nofollow" href="http://forum.taobao.com/showThread.htm?thread=3123988&forum=14" target="_blank">http://forum.taobao.com/showThread.htm?thread=3123988&forum=14</a> target=&#39;_blank&#39;>刷卡积分可网上购物 </a></li> 
<li><a href=/alipay/news/sample/23492.htm target=&#39;_blank&#39;>支付宝为网店保驾护航 </a></li> 
<li><a href=<a rel="nofollow" href="http://it.people.com.cn/GB/8219/50656/52310/3822563.html" target="_blank">http://it.people.com.cn/GB/8219/50656/52310/3822563.html</a> target=&#39;_blank&#39;>支付宝红包送来红地毯 </a></li> 
<li><a href=/alipay/news/sample/22701.htm target=&#39;_blank&#39;>紧急天气预报"红色风暴"空降支付宝 </a></li> 
<li><a href=/alipay/news/sample/22699.htm target=&#39;_blank&#39;>小红包背后大名堂 </a></li> 
<li><a href=<a rel="nofollow" href="http://www.q88.net/SHOP_2005A/zfb.aspx" target="_blank">http://www.q88.net/SHOP_2005A/zfb.aspx</a> target=&#39;_blank&#39;>Q88.net全面无缝接合支付宝 </a></li> 
<li><a href=/alipay/news/sample/21529.htm target=&#39;_blank&#39;>电子支付规范走出第一步 使用专业版受鼓励 </a></li> 
<li><a href=/alipay/news/sample/19786.htm target=&#39;_blank&#39;>从支付宝看电子商务的发展 </a></li> 
<li><a href=/alipay/news/sample/19784.htm target=&#39;_blank&#39;>谁能与支付宝PK? </a></li> 
<li><a href=/alipay/news/sample/19618.htm target=&#39;_blank&#39;>国内第一家引入支付宝的网络图库正式开通 </a></li> 
<li><a href=/alipay/news/sample/19475.htm target=&#39;_blank&#39;>新浪网:中关村在线加入支付宝联盟 </a></li> 
<li><a href=/alipay/news/sample/19471.htm target=&#39;_blank&#39;>千家网店加入支付宝联盟 </a></li> 
<li><a href=/alipay/news/sample/18549.htm target=&#39;_blank&#39;>我与支付宝的分分秒秒 </a></li> 
<li><a href=/alipay/news/sample/18207.htm target=&#39;_blank&#39;>支付宝—放心"网宝"的理由 </a></li> 
<li><a href=/alipay/news/sample/17944.htm target=&#39;_blank&#39;>欧飞数卡携手支付宝,再创新高 </a></li> 
<li><a href=/alipay/news/sample/17803.htm target=&#39;_blank&#39;>莎莎香水网:支付宝助我完成销售计划 </a></li> 
<li><a href=/alipay/news/sample/17801.htm target=&#39;_blank&#39;>使用支付宝:一个月交易额翻5倍 </a></li> 
<li><a href=/alipay/news/sample/17799.htm target=&#39;_blank&#39;>支付宝:一个普通站长的自述 </a></li> 
<li><a href=/alipay/news/sample/17797.htm target=&#39;_blank&#39;>新开网店如何日交易额达8000元? </a></li> 
<li><a href=/alipay/news/sample/17563.htm target=&#39;_blank&#39;>名大数码:网店月交易额如何突破30万 </a></li> 
<li><a href=<a rel="nofollow" href="http://it.sohu.com/20050916/n240400443.shtml" target="_blank">http://it.sohu.com/20050916/n240400443.shtml</a> target=&#39;_blank&#39;>中国卡网结盟支付宝创交易量周增长新高 </a></li> 
<li><a href=<a rel="nofollow" href="http://it.people.com.cn/GB/42891/42894/3676101.html" target="_blank">http://it.people.com.cn/GB/42891/42894/3676101.html</a> target=&#39;_blank&#39;>支付宝联盟与合作伙伴合作在人民网推广 </a></li> 
<li><a href=<a rel="nofollow" href="http://forum.taobao.com/show_thread-50---103546-.htm" target="_blank">http://forum.taobao.com/show_thread-50---103546-.htm</a> target=&#39;_blank&#39;>网络银行使用全攻略---足不出户查看汇款明细 </a></li> 
<li><a href=<a rel="nofollow" href="http://forum.taobao.com/show_thread-50---1561087-.htm" target="_blank">http://forum.taobao.com/show_thread-50---1561087-.htm</a> target=&#39;_blank&#39;>"支付宝购物体验"征文-----贿赂 </a></li> 
<li><a href=<a rel="nofollow" href="http://forum.taobao.com/show_thread-50---2102458-.htm" target="_blank">http://forum.taobao.com/show_thread-50---2102458-.htm</a> target=&#39;_blank&#39;>卖家谈:谁是支付宝最终的获利者? </a></li> 
<li><a href=<a rel="nofollow" href="http://forum.taobao.com/show_thread-50---1617047-.htm" target="_blank">http://forum.taobao.com/show_thread-50---1617047-.htm</a> target=&#39;_blank&#39;>淘宝两钻卖家感悟支付宝 </a></li> 
<li><a href=<a rel="nofollow" href="http://forum.taobao.com/show_thread-50---1686484-.htm" target="_blank">http://forum.taobao.com/show_thread-50---1686484-.htm</a> target=&#39;_blank&#39;>支付宝"即时到帐交易"的使用经验及建议 </a></li> 
<li><a href=<a rel="nofollow" href="http://forum.taobao.com/show_thread-50---1794216-.htm" target="_blank">http://forum.taobao.com/show_thread-50---1794216-.htm</a> target=&#39;_blank&#39;>我的第一笔网上交易 </a></li> 
</ul> 
<ul id="listcontent2">列表信息加载中,请您稍等……</ul> 
<script language="JavaScript"> 
<!-- 
var pager = new ETNGpager(&#39;listcontent&#39;,&#39;listcontent2&#39;,10,5); 
var curP = 1; 
showtime = setInterval("page()", 5000); 
function page(i){ 
curP =(curP>pager.cntP)?1:curP; 
if(i){ 
curP = n =i; 
}else{ 
n = curP++; 
} 
pager.curP = (n>pager.cntP)?pager.cntP:n; 
pager.create(); 
} 
//--> 
</script> 
</body> 
</html>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use JS and Baidu Maps to implement map pan function How to use JS and Baidu Maps to implement map pan function Nov 21, 2023 am 10:00 AM

How to use JS and Baidu Map to implement map pan function Baidu Map is a widely used map service platform, which is often used in web development to display geographical information, positioning and other functions. This article will introduce how to use JS and Baidu Map API to implement the map pan function, and provide specific code examples. 1. Preparation Before using Baidu Map API, you first need to apply for a developer account on Baidu Map Open Platform (http://lbsyun.baidu.com/) and create an application. Creation completed

Recommended: Excellent JS open source face detection and recognition project Recommended: Excellent JS open source face detection and recognition project Apr 03, 2024 am 11:55 AM

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages ​​and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

Essential tools for stock analysis: Learn the steps to draw candle charts with PHP and JS Essential tools for stock analysis: Learn the steps to draw candle charts with PHP and JS Dec 17, 2023 pm 06:55 PM

Essential tools for stock analysis: Learn the steps to draw candle charts in PHP and JS. Specific code examples are required. With the rapid development of the Internet and technology, stock trading has become one of the important ways for many investors. Stock analysis is an important part of investor decision-making, and candle charts are widely used in technical analysis. Learning how to draw candle charts using PHP and JS will provide investors with more intuitive information to help them make better decisions. A candlestick chart is a technical chart that displays stock prices in the form of candlesticks. It shows the stock price

How to create a stock candlestick chart using PHP and JS How to create a stock candlestick chart using PHP and JS Dec 17, 2023 am 08:08 AM

How to use PHP and JS to create a stock candle chart. A stock candle chart is a common technical analysis graphic in the stock market. It helps investors understand stocks more intuitively by drawing data such as the opening price, closing price, highest price and lowest price of the stock. price fluctuations. This article will teach you how to create stock candle charts using PHP and JS, with specific code examples. 1. Preparation Before starting, we need to prepare the following environment: 1. A server running PHP 2. A browser that supports HTML5 and Canvas 3

How to use JS and Baidu Map to implement map click event processing function How to use JS and Baidu Map to implement map click event processing function Nov 21, 2023 am 11:11 AM

Overview of how to use JS and Baidu Maps to implement map click event processing: In web development, it is often necessary to use map functions to display geographical location and geographical information. Click event processing on the map is a commonly used and important part of the map function. This article will introduce how to use JS and Baidu Map API to implement the click event processing function of the map, and give specific code examples. Steps: Import the API file of Baidu Map. First, import the file of Baidu Map API in the HTML file. This can be achieved through the following code:

How to use JS and Baidu Maps to implement map heat map function How to use JS and Baidu Maps to implement map heat map function Nov 21, 2023 am 09:33 AM

How to use JS and Baidu Maps to implement the map heat map function Introduction: With the rapid development of the Internet and mobile devices, maps have become a common application scenario. As a visual display method, heat maps can help us understand the distribution of data more intuitively. This article will introduce how to use JS and Baidu Map API to implement the map heat map function, and provide specific code examples. Preparation work: Before starting, you need to prepare the following items: a Baidu developer account, create an application, and obtain the corresponding AP

PHP and JS Development Tips: Master the Method of Drawing Stock Candle Charts PHP and JS Development Tips: Master the Method of Drawing Stock Candle Charts Dec 18, 2023 pm 03:39 PM

With the rapid development of Internet finance, stock investment has become the choice of more and more people. In stock trading, candle charts are a commonly used technical analysis method. It can show the changing trend of stock prices and help investors make more accurate decisions. This article will introduce the development skills of PHP and JS, lead readers to understand how to draw stock candle charts, and provide specific code examples. 1. Understanding Stock Candle Charts Before introducing how to draw stock candle charts, we first need to understand what a candle chart is. Candlestick charts were developed by the Japanese

How to use JS and Baidu Maps to implement map polygon drawing function How to use JS and Baidu Maps to implement map polygon drawing function Nov 21, 2023 am 10:53 AM

How to use JS and Baidu Maps to implement map polygon drawing function. In modern web development, map applications have become one of the common functions. Drawing polygons on the map can help us mark specific areas for users to view and analyze. This article will introduce how to use JS and Baidu Map API to implement map polygon drawing function, and provide specific code examples. First, we need to introduce Baidu Map API. You can use the following code to import the JavaScript of Baidu Map API in an HTML file

See all articles