Home  >  Article  >  php教程  >  用jquery实现TP3.2.2版最简单分页

用jquery实现TP3.2.2版最简单分页

WBOY
WBOYOriginal
2016-06-07 11:41:441510browse

用jquery实现TP3.2.2版最简单分页,不需要更改任何PHP代码。
首页需要给显示分页的外部元素加一个ID标识,如ajaxPage<div>{$show}</div>在JS代码中使用jquery功能直接获取分页A中的href值并赋给一个新的自定义属性,如:topage,接下来就直接读topage值,进行分期操作。$("#ajaxPage a").each(function(){<br>         var href = $(this).attr("href");<br>         var re = /\/p\/(\d+)\.html/gi;<br>         var find = re.exec(href);<br>         $(this).attr({'topage':find[1].toString(),'href':'javascript:;'});<br>     }).bind("click", function(){<br>         var topage = $(this).attr('topage');<br>         //这里得到topage值自己来实现你的业务操作<br>     });以上并非完整示例代码,只是作为抛砖引玉之作。

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
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