搜索
首页web前端js教程js 分页代码带切换效果_javascript技巧

载入需要点时间,请稍微等待。

<!-- 
/* 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>
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
JavaScript引擎:比较实施JavaScript引擎:比较实施Apr 13, 2025 am 12:05 AM

不同JavaScript引擎在解析和执行JavaScript代码时,效果会有所不同,因为每个引擎的实现原理和优化策略各有差异。1.词法分析:将源码转换为词法单元。2.语法分析:生成抽象语法树。3.优化和编译:通过JIT编译器生成机器码。4.执行:运行机器码。V8引擎通过即时编译和隐藏类优化,SpiderMonkey使用类型推断系统,导致在相同代码上的性能表现不同。

超越浏览器:现实世界中的JavaScript超越浏览器:现实世界中的JavaScriptApr 12, 2025 am 12:06 AM

JavaScript在现实世界中的应用包括服务器端编程、移动应用开发和物联网控制:1.通过Node.js实现服务器端编程,适用于高并发请求处理。2.通过ReactNative进行移动应用开发,支持跨平台部署。3.通过Johnny-Five库用于物联网设备控制,适用于硬件交互。

使用Next.js(后端集成)构建多租户SaaS应用程序使用Next.js(后端集成)构建多租户SaaS应用程序Apr 11, 2025 am 08:23 AM

我使用您的日常技术工具构建了功能性的多租户SaaS应用程序(一个Edtech应用程序),您可以做同样的事情。 首先,什么是多租户SaaS应用程序? 多租户SaaS应用程序可让您从唱歌中为多个客户提供服务

如何使用Next.js(前端集成)构建多租户SaaS应用程序如何使用Next.js(前端集成)构建多租户SaaS应用程序Apr 11, 2025 am 08:22 AM

本文展示了与许可证确保的后端的前端集成,并使用Next.js构建功能性Edtech SaaS应用程序。 前端获取用户权限以控制UI的可见性并确保API要求遵守角色库

JavaScript:探索网络语言的多功能性JavaScript:探索网络语言的多功能性Apr 11, 2025 am 12:01 AM

JavaScript是现代Web开发的核心语言,因其多样性和灵活性而广泛应用。1)前端开发:通过DOM操作和现代框架(如React、Vue.js、Angular)构建动态网页和单页面应用。2)服务器端开发:Node.js利用非阻塞I/O模型处理高并发和实时应用。3)移动和桌面应用开发:通过ReactNative和Electron实现跨平台开发,提高开发效率。

JavaScript的演变:当前的趋势和未来前景JavaScript的演变:当前的趋势和未来前景Apr 10, 2025 am 09:33 AM

JavaScript的最新趋势包括TypeScript的崛起、现代框架和库的流行以及WebAssembly的应用。未来前景涵盖更强大的类型系统、服务器端JavaScript的发展、人工智能和机器学习的扩展以及物联网和边缘计算的潜力。

神秘的JavaScript:它的作用以及为什么重要神秘的JavaScript:它的作用以及为什么重要Apr 09, 2025 am 12:07 AM

JavaScript是现代Web开发的基石,它的主要功能包括事件驱动编程、动态内容生成和异步编程。1)事件驱动编程允许网页根据用户操作动态变化。2)动态内容生成使得页面内容可以根据条件调整。3)异步编程确保用户界面不被阻塞。JavaScript广泛应用于网页交互、单页面应用和服务器端开发,极大地提升了用户体验和跨平台开发的灵活性。

Python还是JavaScript更好?Python还是JavaScript更好?Apr 06, 2025 am 12:14 AM

Python更适合数据科学和机器学习,JavaScript更适合前端和全栈开发。 1.Python以简洁语法和丰富库生态着称,适用于数据分析和Web开发。 2.JavaScript是前端开发核心,Node.js支持服务器端编程,适用于全栈开发。

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
3 周前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解锁Myrise中的所有内容
4 周前By尊渡假赌尊渡假赌尊渡假赌

热工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

将Eclipse与SAP NetWeaver应用服务器集成。

DVWA

DVWA

Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

SublimeText3 英文版

SublimeText3 英文版

推荐:为Win版本,支持代码提示!

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器