js写分页
来源:互联网 发布:淘宝挣钱 编辑:程序博客网 时间:2024/06/18 07:12
<a href="#" onclick="getPrice(1,10)">首页</a> <a href="#" onclick="forward()">上一页</a> <a href="#" class="page_first" id="currentPage"></a> <a href="#" id="currentPageAdd1" onclick="changePage(this.id)"></a> <a href="#" id="currentPageAdd2" onclick="changePage(this.id)"></a> <a href="#" id="currentPageAdd3" onclick="changePage(this.id)"></a> <a href="#" id="currentPageAdd4" onclick="changePage(this.id)"></a> <a href="#" onclick="back()">下一页</a> <a href="#" onclick="getPrice(-1,10)">末页</a> <i>共<i id="pageSum"></i>页</i><SCRIPT type="text/javascript">function changePage(val){//alert(val);currentPage=$("#"+val).text();//alert(currentPage);currentPage=parseInt(currentPage);getPrice(currentPage,"10");}function forward(){var currentPage=$("#currentPage").text();currentPage=parseInt(currentPage);if(currentPage>1){currentPage=currentPage-1;}getPrice(currentPage,"10");}function back(){var currentPage=$("#currentPage").text();var pageSum=$("#pageSum").text();if(parseInt(currentPage)<parseInt(pageSum)){currentPage=parseInt(currentPage)+1;}getPrice(currentPage,"10");}function getPrice(currentPage,pageSize){ //alert(currentPage); $("#currentPageAdd1").text(parseInt(currentPage)+1); $("#currentPageAdd2").text(parseInt(currentPage)+2); $("#currentPageAdd3").text(parseInt(currentPage)+3); $("#currentPageAdd4").text(parseInt(currentPage)+4); if(currentPage==-1){ currentPage=$("#pageSum").text(); }var _url = "<%=request.getContextPath()%>/user/getDataFromURL.html";$.ajax({ type: 'POST', url: _url, data: {"currentPage":currentPage,"pageSize":pageSize}, dataType: "json", success: function(data){$("#pricehangqingtongji").empty();if (data.success==1){//alert(data.price.totalCount);var pageSum=0;if(data.price.rows.length%pageSize+"".indexOf(".")==-1){pageSum=data.price.totalCount/pageSize+"";pageSum=pageSum.split(".")[0];}else{pageSum=parseInt(data.price.totalCount/pageSize)+1+"";pageSum=pageSum.split(".")[0];}$("#pageSum").text(pageSum);$("#currentPage").text(currentPage);$.each(data.price.rows,function(index,value){var li ='';li +='<ul class="list-con">';li +=' </ul>';$("#pricehangqingtongji").append(li);}); }}});}
阅读全文
0 0
- js写的分页
- js写分页
- 纯js写的分页
- 纯JS写的分页代码。
- 自己写的一个JS表格分页代码第一版
- 纯js写的xml数据分页显示程序
- 纯js写分页 (算法把我纠结住了)
- 刚写的一个js分页类,未优化
- 网站真分页js代码该怎么写?
- 自己js写的分页小工具供大家参考
- js分页
- 分页js
- 分页JS
- js分页
- js分页
- js分页
- js分页
- js 分页
- Java Spring MVC进阶(2)--@produces、@PathVariable、@RequestParam等
- OpenCV中的均值与最值的计算
- TCP状态转换图
- ThinkPHP3.23整合phpqrcode生成二维码(logo)
- python多线程,获取多线程的返回值
- js写分页
- Cache 三种的映射方法
- Win10虚拟机中安装office2016
- H&E染色切片patch的标准化算法
- imfilter用法以及滤波讲解
- c++-挑选镇长
- php-cli和php-fpm的关系是什么?
- STL模板的容器理解
- python与自然语言处理 2结巴分词