DW怎么实现分页?谢谢了

如题所述

呵呵给你一个现成的好了,它对静态分页比较 <script language="JavaScript" type="text/javascript">//createPageHTML(${PAGE_COUNT}, ${PAGE_INDEX}, "${PAGE_NAME}", "${PAGE_EXT}");
var currentPage = ${PAGE_INDEX};//所在页从0开始
//var headPage = "${PAGE_NAME}"+"."+"${PAGE_EXT}";//首页
//var tailPage = "${PAGE_NAME}_" + (countPage-1) + ".${PAGE_EXT}"//尾页
var prevPage = currentPage-1//上一页
var nextPage = currentPage+1//下一页
var countPage = ${PAGE_COUNT}//共多少页document.write("共"+countPage+"页 ");
//设置上一页代码
if(countPage>1&¤tPage!=0&¤tPage!=1)
document.write("<a href=\"${PAGE_NAME}.${PAGE_EXT}\">首页</a> <a href=\"${PAGE_NAME}"+"_" + prevPage + "."+"${PAGE_EXT}\">上一页</a> ");
else if(countPage>1&¤tPage!=0&¤tPage==1)
document.write("<a href=\"${PAGE_NAME}.${PAGE_EXT}\">首页</a> <a href=\"${PAGE_NAME}.${PAGE_EXT}\">上一页</a> ");
else
document.write("首页 上一页 ");
//循环
var num = 5;
for(var i=0+(currentPage-1-(currentPage-1)%num) ; i<=(num+(currentPage-1-(currentPage-1)%num))&&(i<countPage) ; i++){
if(currentPage==i)
document.write((i+1)+" ");
else if(i==0){
document.write("<a href=\"${PAGE_NAME}.${PAGE_EXT}\">"+1+"</a> ");
}else
document.write("<a href=\"${PAGE_NAME}"+"_" + i + "."+"${PAGE_EXT}\">"+(i+1)+"</a> ");
}//设置下一页代码
if(countPage>1&¤tPage!=(countPage-1))
document.write("<a href=\"${PAGE_NAME}"+"_" + nextPage + "."+"${PAGE_EXT}\">下一页</a> <a href=\"${PAGE_NAME}_" + (countPage-1) + ".${PAGE_EXT}\">尾页</a> ");
else
document.write("下一页 尾页 ");

//跳转页面
document.write("<font class='9ptb'>转到第<input type='text' id='num' value="+(currentPage+1)+" style='width:30px'>页"+
" <input type='submit' value='提交' onClick=javacript:toPage()></font>");

function toPage(){
var _num = document.getElementById("num").value;
var str = "${PAGE_NAME}"+"_"+(_num-1)+"."+"${PAGE_EXT}";
var url = location.href.substring(0,location.href.lastIndexOf("/")+1);
if(_num<=1||_num==null)
location.href = url+"${PAGE_NAME}"+"."+"${PAGE_EXT}";
else if(_num>countPage)
alert("本频道最多"+countPage+"页");
else
location.href = url+str;
}
</script>
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-10-13
自己写分页,好像dw有插件分页不过得去找那个插件去
相似回答