一地风飞
全部博文(129)
2011年(1)
2007年(26)
2006年(102)
hxl
屁股发痒
yjwself
shyshysh
闫小样丶
shiyehui
yejia805
灿烂小猪
qintel
分类: 系统运维
2006-04-27 10:00:35
var nowPageUrl = window.location+'';var nNowPage=1;var nMaxPage=1;function GetNoNowpageArgUrl(){ var pattern = /^(.*)(\#|\?|\&)nowpage=(\d*)(\&?)(.*)$/i; var pattern2 =/^(.*)(\#|\?)(.*)$/i var result = nowPageUrl.match(pattern); if (result!=null) { nNowPage = result[3]; if (result[2] == '?' || result[2] == '#') { if (result[4]=="") { var newUrl = result[1]+result[2]; } else { var newUrl = result[1]+result[2]+result[5]+"\&"; } } else { if (result[5]=="") { var newUrl = result[1]+"\&"; } else { var newUrl = result[1]+"\&"+result[5]+"\&"; } } } else { var result2 = nowPageUrl.match(pattern2); if (result2==null) { var newUrl = nowPageUrl + "\?"; } else { if (result2[3]=="") { var newUrl = result2[1]+result2[2]; } else { var newUrl = result2[1]+result2[2]+result2[3] + "\&"; } } } return newUrl;}var nNewUrl = GetNoNowpageArgUrl();function jump(nStart){ nStart = nStart-1+1; if (!nStart || nStart==NaN || nStart=="" || nStart == null) return; if (nStart > nMaxPage) return; if (nStart < 1) return; if (nStart == nNowPage) return; window.location = nNewUrl + "nowpage=" + nStart}function upPage(){ if (nNowPage<=1) return; var nStart=nNowPage-1; jump(nStart);}function downPage(){ if (nNowPage>=nMaxPage) return; var nStart=nNowPage-1+2; jump(nStart);}function firstPage(){ if (nNowPage<=1) return; var nStart=1; jump(nStart);}function lastPage(){ if (nNowPage>=nMaxPage) return; var nStart=nMaxPage; jump(nStart);}function writeCleftPage(nMaxNumber,nPageNumber,nStyle){ if (nPageNumber==0 || nPageNumber==null) { nPageNumber = 1; } nMaxPage = Math.ceil( nMaxNumber / nPageNumber ); var nStartNumber = nNowPage*nPageNumber-nPageNumber+1; if (nNowPage==nMaxPage) { var nOverNumber = nMaxNumber; } else { var nOverNumber = nNowPage*nPageNumber; } var writeStr = GetCleftPage(nMaxNumber,nPageNumber,nNowPage,nMaxPage,nStartNumber,nOverNumber,nStyle); document.writeln(writeStr);}function GetCleftPageStyle(s){ var style = new Array(); style[0] = ''; style[1] = ''; s = style[s] ? s : 0 ; return style[s];}function GetCleftPage(nMaxNumber,nPageNumber,nNowPage,nMaxPage,nStartNumber,nOverNumber,nStyle){ var style = GetCleftPageStyle(nStyle) var nEchoString = '
上一篇:memcache使用简述
下一篇:一个基于xml的二级连动,兼容IE和FF
登录 注册