Thinkphp点击确定跳转输入框页

浏览:4917 最后更新:2016-01-18 20:13 分类:示例 关键字: 分页 跳转

THINKPHP的系统分页类已改
首先在分页类里添加跳转页代码'inputer' => "<span class='extra'><span class='text'>共%TOTAL_PAGE%页,</span><span class='text'>到第</span><input class='page-num' value='%NEXT_PAGE%' type='number' id='page-num'> 
    <span class='text'>页</span><span class='page-submit' id='page-submit' type='button' onclick='getInputPage()' data-page='%JUMP_PAGE%'>确定</span></span>"
自定义分页数量,来显示跳转页htmlif ($this->totalPages >= 2) { 
    $down_row = $down_row > $this->totalPages ? $this->totalPages : $down_row; 
    $page_inputer = str_replace( 
            array('%NEXT_PAGE%', '%TOTAL_PAGE%', '%JUMP_PAGE%'), array($down_row, $this->totalPages, $url_last), $this->config['inputer']); 
}
js点击确定或enter键提交分页function getInputPage() {
    var page = $("#page-num").val();
    var page_url = decodeURI($("#page-submit").attr("data-page"));
    page_url = page_url.replace('[PAGE]', page)
    location.href = page_url;
}
$("#page-num").keydown(function(e) {
    var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
    if (key == 13) {
        e.preventDefault();
        getInputPage()
    }
});
分页跳转演示地址:http://www.sucaihuo.com/php/563.html
评论( 相关
后面还有条评论,点击查看>>