首页 >

js脚本分页代码分享(7种样式)【javascript】

web前端|js教程js脚本分页代码分享(7种样式)【javascript】
js脚本代码,js实现分页代码,js分页代码,纯js前段实现分页代码
web前端-js教程
本文跟大家分享了7种JS脚本分页样式,相信总有一款是适合你的哦
云购下单源码,ubuntu的dns设置,自制爬虫加热垫,php5和php7差异,韩国seo成员lzw
抓紧先上图给大家挑选一下——————运行效果——————-
资源下载 整站源码,便携 ubuntu开发本,怎么配置tomcat4.1,爬虫融资租赁,505php,抚州推广抖音seo优化哪家好lzw
转码系统源码,vscode图片做背景,ubuntu 设置字体,tomcat jbpm,sqlite3数组存取,网页设计实践,php数据库的连接函数,社区网站 租用服务器还是只需要购买空间,bootstrap日历插件中文,程序员前端框架工具,爬虫卖数据,php substr,天津 seo,springboot技巧,火车头采集器 时间标签,玩具 网站模板,css3网页加载旋转动画,精美网页模板下载,帝国cms后台推荐文章提示你没有更改属性权限,手机和网站页面模板,web固定资产管理系统模板,易语言启动程序lzw
其实小编挺喜欢最后一款的,亲,你呐?

为大家再分享实现JS脚本分页的代码,直接复制代码,运行即可,抓紧试试吧

7种JS脚本分页代码body {font-size: 12px;}/* Pages Main Tyle */.pages { color: #000000; cursor: default; font-size: 10px; font-family: Tahoma, Verdana; padding: 3px 0px 3px 0px;}.pages .count, .pages .number, .pages .arrow { color: #000000; font-size: 10px; background-color: #F7F7F7; border: 1px solid #CCCCCC;}/* Page and PageCount Style */.pages .count { font-weight: bold; border-right: none; padding: 2px 10px 1px 10px;}/* Mode 0,1,2 Style (Number) */.pages .number { font-weight: normal; padding: 2px 10px 1px 10px;}.pages .number a, .pages .number span { font-size: 10px;}.pages .number span { color: #999999; margin: 0px 3px 0px 3px;}.pages .number a { color: #000000; text-decoration: none;}.pages .number a:hover { color: #0000ff;}/* Mode 3 Style (Arrow) */.pages .arrow { font-weight: normal; padding: 0px 5px 0px 5px;}.pages .arrow a, .pages .arrow span { font-size: 10px; font-family: Webdings;}.pages .arrow span { color: #999999; margin: 0px 5px 0px 5px;}.pages .arrow a { color: #000000; text-decoration: none;}.pages .arrow a:hover { color: #0000ff;}/* Mode 4 Style (Select) */.pages select, .pages input { color: #000000; font-size: 10px; font-family: Tahoma, Verdana;}/* Mode 5 Style (Input) */.pages .input input.ititle, .pages .input input.itext, .pages .input input.icount { color: #666666; font-weight: bold; background-color: #F7F7F7; border: 1px solid #CCCCCC;}.pages .input input.ititle { width: 70px; text-align: right; border-right: none;}.pages .input input.itext { width: 25px; color: #000000; text-align: right; border-left: none; border-right: none;}.pages .input input.icount { width: 35px; text-align: left; border-left: none;}.pages .input input.ibutton { height: 17px; color: #FFFFFF; font-weight: bold; font-family: Verdana; background-color: #999999; border: 1px solid #666666; padding: 0px 0px 2px 1px; margin-left: 2px; cursor: hand;}<!--function showPages(name) { //初始化属性 this.name = name;  //对象名称 this.page = 1;   //当前页数 this.pageCount = 1; //总页数 this.argName = 'page'; //参数名 this.showTimes = 1; //打印次数}showPages.prototype.getPage = function(){ //丛url获得当前页数,如果变量重复只获取最后一个 var args = location.search; var reg = new RegExp('[\?&]?' + this.argName + '=([^&]*)[&$]?', 'gi'); var chk = args.match(reg); this.page = RegExp.$1;}showPages.prototype.checkPages = function(){ //进行当前页数和总页数的验证 if (isNaN(parseInt(this.page))) this.page = 1; if (isNaN(parseInt(this.pageCount))) this.pageCount = 1; if (this.page < 1) this.page = 1; if (this.pageCount  this.pageCount) this.page = this.pageCount; this.page = parseInt(this.page); this.pageCount = parseInt(this.pageCount);}showPages.prototype.createHtml = function(mode){ //生成html代码 var strHtml = '', prevPage = this.page - 1, nextPage = this.page + 1; if (mode == '' || typeof(mode) == 'undefined') mode = 0; switch (mode) { case 0 : //模式1 (页数,首页,前页,后页,尾页) strHtml += 'Pages: ' + this.page + ' / ' + this.pageCount + ''; strHtml += ''; if (prevPage < 1) { strHtml += '«'; strHtml += '‹'; } else { strHtml += '«'; strHtml += '‹'; } for (var i = 1; i  0) {  if (i == this.page) {  strHtml += '[' + i + ']';  } else {  strHtml += '[' + i + ']';  } } } if (nextPage > this.pageCount) { strHtml += '›'; strHtml += '»'; } else { strHtml += '›'; strHtml += '»'; } strHtml += '
'; break; case 1 : //模式1 (10页缩略,首页,前页,后页,尾页) strHtml += 'Pages: ' + this.page + ' / ' + this.pageCount + ''; strHtml += ''; if (prevPage 10) strHtml += '...'; for (var i = startPage; i this.pageCount) break; if (i == this.page) { strHtml += '[' + i + ']'; } else { strHtml += '[' + i + ']'; } } if (this.pageCount >= startPage + 10) strHtml += '...'; if (nextPage > this.pageCount) { strHtml += '›'; strHtml += '»'; } else { strHtml += '›'; strHtml += '»'; } strHtml += '
'; break; case 2 : //模式2 (前后缩略,页数,首页,前页,后页,尾页) strHtml += 'Pages: ' + this.page + ' / ' + this.pageCount + ''; strHtml += ''; if (prevPage = 5) strHtml += '...'; if (this.pageCount > this.page + 2) { var endPage = this.page + 2; } else { var endPage = this.pageCount; } for (var i = this.page - 2; i 0) { if (i == this.page) { strHtml += '[' + i + ']'; } else { if (i != 1 && i != this.pageCount) { strHtml += '[' + i + ']'; } } } } if (this.page + 3 this.pageCount) { strHtml += '›'; strHtml += '»'; } else { strHtml += '›'; strHtml += '»'; } strHtml += '
'; break; case 3 : //模式3 (箭头样式,首页,前页,后页,尾页) (only IE) strHtml += 'Pages: ' + this.page + ' / ' + this.pageCount + ''; strHtml += ''; if (prevPage this.pageCount) { strHtml += '8'; strHtml += ':'; } else { strHtml += '8'; strHtml += ':'; } strHtml += '
'; break; case 4 : //模式4 (下拉框) if (this.pageCount < 1) { strHtml += ''; strHtml += 'No Pages'; } else { var chkSelect; strHtml += ''; for (var i = 1; i <= this.pageCount; i++) { if (this.page == i) chkSelect=' selected="selected"'; else chkSelect=''; strHtml += 'Pages: ' + i + ' / ' + this.pageCount + ''; } } strHtml += ''; break; case 5 : //模式5 (输入框) strHtml += ''; if (this.pageCount < 1) { strHtml += ''; strHtml += ''; } else { strHtml += ''; strHtml += ''; strHtml += ''; strHtml += ''; } strHtml += ''; break; default : strHtml = 'Javascript showPage Error: not find mode ' + mode; break; } return strHtml;}showPages.prototype.createUrl = function (page) { //生成页面跳转url if (isNaN(parseInt(page))) page = 1; if (page this.pageCount) page = this.pageCount; var url = location.protocol + '//' + location.host + location.pathname; var args = location.search; var reg = new RegExp('([\?&]?)' + this.argName + '=[^&]*[&$]?', 'gi'); args = args.replace(reg,'$1'); if (args == '' || args == null) { args += '?' + this.argName + '=' + page; } else if (args.substr(args.length - 1,1) == '?' || args.substr(args.length - 1,1) == '&') { args += this.argName + '=' + page; } else { args += '&' + this.argName + '=' + page; } return url + args;}showPages.prototype.toPage = function(page){ //页面跳转 var turnTo = 1; if (typeof(page) == 'object') { turnTo = page.options[page.selectedIndex].value; } else { turnTo = page; } self.location.href = this.createUrl(turnTo);}showPages.prototype.printHtml = function(mode){ //显示html代码 this.getPage(); this.checkPages(); this.showTimes += 1; document.write('
'); document.getElementById('pages_' + this.name + '_' + this.showTimes).innerHTML = this.createHtml(mode); }showPages.prototype.formatInputPage = function(e){ //限定输入页数格式 var ie = navigator.appName=="Microsoft Internet Explorer"?true:false; if(!ie) var key = e.which; else var key = event.keyCode; if (key == 8 || key == 46 || (key >= 48 && key

<!--var pg = new showPages('pg');pg.pageCount =12; // 定义总页数(必要)//pg.argName = 'p'; // 定义参数名(可选,默认为page)document.write('
Show Times: ' + pg.showTimes + ', Mood Default');pg.printHtml();document.write('
Show Times: ' + pg.showTimes + ', Mood 0');pg.printHtml(0);document.write('
Show Times: ' + pg.showTimes + ', Mood 1');pg.printHtml(1);document.write('
Show Times: ' + pg.showTimes + ', Mood 2');pg.printHtml(2);document.write('
Show Times: ' + pg.showTimes + ', Mood 3 (only IE)');pg.printHtml(3);document.write('
Show Times: ' + pg.showTimes + ', Mood 4');pg.printHtml(4);document.write('
Show Times: ' + pg.showTimes + ', Mood 5');pg.printHtml(5);//-->

以上就是以上就是为大家分享的js脚本分页代码,希望大家可以喜欢。


js脚本分页代码分享(7种样式)【javascript】
  • js分页代码分享
  • js分页代码分享 | js分页代码分享 ...