葉子asp分頁類
名稱: 葉子asp分頁類
name: showopage(vbs class)
rcsfile: readme.txt
revision: 0.12.20051114.f
author: yehe(葉子)
released: 2005-11-14 09:40:13
descript: asp分頁類,支持access/mssql/mysql/sqlite
contact: qq:311673 msn:myehe@msn.com gt:mmyehe@gmail.com
website: http://www.yehe.org http://www.showo.com
------------------------------------------------
licenses:
本程序遵循gpl協(xié)議.
協(xié)議原文地址:http://www.gnu.org/licenses/licenses.cn.html#gpl
------------------------------------------------
thanks:
可洛: 感謝mssql分頁核心部分
arbiter: 感謝部分分頁思路
才子: 感謝推廣
foxty: 感謝分頁思路
------------------------------------------------
install:
1.具體調(diào)用方法可以看demo的asp文檔.
2.mssql存儲過程版的請先執(zhí)行sp_util_page.sql文件添加存儲過程.
3.sp調(diào)用方法:
exec sp_util_page 440000,4,10,''mid'',''mid,ip1,ip2,country,city'',''tbtemppage'',''1=1'',''mid asc''
記錄條數(shù)(已有值:序外部賦值,0執(zhí)行count),當前頁數(shù),每頁記錄數(shù),主鍵,字段,表,條件(不需要where),排序(不需要order by,需要asc和desc字符)
如果不按主鍵排序,則排序賦值里面不能出現(xiàn)主鍵字符.
------------------------------------------------
release:
0.12
1.取text字段類型bug修正
2.存儲過程bug修正
3.代碼修正
0.11
1.存儲過程加了非主鍵排序下的分頁
2.去掉了mssql的非存儲過程版分頁
0.10:
1.條件簡化
2.存儲過程優(yōu)化
0.09:
1.排序判斷部分優(yōu)化
0.08:
1.vbs bug修正
0.07:
1.bug修正,包括vbs類和js
0.06beta:
1.js瀏覽器兼容優(yōu)化
2.類幾個函數(shù)的bug修正
0.05beta:
1.全面代碼優(yōu)化,mysql/sqlite支持
2.參數(shù)輸入方式修改
0.04beta:
1.做到調(diào)用代碼一樣適應多種數(shù)據(jù)庫集成分頁
2.js去掉了表單,支持靜態(tài)提交
3.加上了存儲過程
0.03beta:
1.公開發(fā)布的顯示為0.02,其實為0.03,分為ac版類,mssql版類發(fā)布
2.js的bug修正
3.寫成了類,進一步方便調(diào)用
0.02beta:
1.加上對mssql的支持
2.封裝成了函數(shù)版,方便調(diào)用
3.js文件的優(yōu)化
0.01beta:
1.沒有寫成函數(shù),只是找到了比較快的ac分頁方法
2.分頁樣式用js顯示
------------------------------------------------
file:
db/ip.mdb access測試數(shù)據(jù)庫
db/ip mssql備份測試數(shù)據(jù)庫
cls_vbspage.asp 分頁類
cls_jspage.js js分頁樣式
sp_util_page.sql mssql存儲過程
demoac.asp ac分頁調(diào)用示范
demomssql.asp mssql調(diào)用示范
demomssql_sp.asp mssql存儲過程調(diào)用示范
cls_vbspage.asp
<%
class cls_vbspage
private oconn ''連接對象
private ipagesize ''每頁記錄數(shù)
private spagename ''地址欄頁數(shù)參數(shù)名
private sdbtype
''數(shù)據(jù)庫類型,ac為access,mssql為sql server2000存儲過程版,mysql為mysql,pgsql為postgresql
private irectype ''記錄總數(shù)(>0為另外取值再賦予或者固定值,0執(zhí)行count設置存cookies,-1執(zhí)行count不設置cookies)
private sjsurl ''cls_jspage.js的路徑
private sfield ''字段名
private stable ''表名
private scondition ''條件,不需要where
private sorderby ''排序,不需要order by,需要asc或者desc
private spkey ''主鍵,必寫
private ireccount
''================================================================
'' class_initialize 類的初始化
''================================================================
private sub class_initialize
ipagesize=10
spagename="page"
sdbtype="ac"
irectype=0
sjsurl=""
sfield=" * "
end sub
''================================================================
'' conn 得到數(shù)據(jù)庫連接對象
''================================================================
public property set conn(byref value)
set oconn=value
end property
''================================================================
'' pagesize 設置每一頁記錄條數(shù),默認10記錄
''================================================================
public property let pagesize(byval intpagesize)
ipagesize=checknum(intpagesize,0,0,ipagesize,0)
end property
''================================================================
'' pagename 地址欄頁數(shù)參數(shù)名
''================================================================
public property let pagename(byval strpagename)
spagename=iif(len(strpagename)<1,spagename,strpagename)
end property
''================================================================
'' dbtype 得到數(shù)據(jù)庫類型
''================================================================
public property let dbtype(byval strdbtype)
sdbtype=ucase(iif(len(strdbtype)<1,sdbtype,strdbtype))
end property
''================================================================
'' rectype 取記錄總數(shù)(>0為賦值或者固定值,0執(zhí)行count設置存cookies,-1執(zhí)行count不設置cookies適用于搜索)
''================================================================
public property let rectype(byval intrectype)
irectype=checknum(intrectype,0,0,irectype,0)
end property
''================================================================
'' jsurl 取得cls_jspage.js的路徑
''================================================================
public property let jsurl(byval strjsurl)
sjsurl=strjsurl
end property
''================================================================
'' pkey 取得主鍵
''================================================================
public property let pkey(byval strpkey)
spkey=strpkey
end property
''================================================================
'' field 取得字段名
''================================================================
public property let field(byval strfield)
sfield=iif(len(strfield)<1,sfield,strfield)
end property
''================================================================
'' table 取得表名
''================================================================
public property let table(byval strtable)
stable=strtable
end property
''================================================================
'' condition 取得條件
''================================================================
public property let condition(byval strcondition)
s=strcondition
scondition=iif(len(s)>2," where "&s,"")
end property
''================================================================
'' orderby 取得排序
''================================================================
public property let orderby(byval strorderby)
s=strorderby
sorderby=iif(len(s)>4," order by "&s,"")
end property
''================================================================
'' reccount 修正記錄總數(shù)
''================================================================
public property get reccount()
if irectype>0 then
i=irectype
elseif irectype=0 then
i=checknum(request.cookies("showopage")(spagename),1,0,0,0)
s=trim(request.cookies("showopage")("scond"))
if i=0 or scondition<>s then
i=oconn.execute("select count("&spkey&") from "&stable&" "&scondition,0,1)(0)
response.cookies("showopage")(spagename)=i
response.cookies("showopage")("scond")=scondition
end if
else
i=oconn.execute("select count("&spkey&") from "&stable&" "&scondition,0,1)(0)
end if
ireccount=i
reccount=i
end property
''================================================================
'' resultset 返回分頁后的記錄集
''================================================================
public property get resultset()
s=null
''記錄總數(shù)
i=ireccount
''當前頁
if i>0 then
ipagecount=abs(int(-abs(i/ipagesize)))''頁數(shù)
ipagecurr=checknum(request.querystring(spagename),1,1,1,ipagecount)''當前頁
select case sdbtype
case "mssql" ''sqlserver2000數(shù)據(jù)庫存儲過程版
set rs=server.createobject("adodb.recordset")
set cm=server.createobject("adodb.command")
cm.commandtype=4
cm.activeconnection=oconn
cm.commandtext="sp_util_page"
cm.parameters(1)=i
cm.parameters(2)=ipagecurr
cm.parameters(3)=ipagesize
cm.parameters(4)=spkey
cm.parameters(5)=sfield
cm.parameters(6)=stable
cm.parameters(7)=replace(scondition," where ","")
cm.parameters(8)=replace(sorderby," order by ","")
rs.cursorlocation=3
rs.locktype=1
rs.open cm
case "mysql" ''mysql數(shù)據(jù)庫
resultset_sql="select "&sfield&" from "&stable&" "&scondition&" "&sorderby&" limit "&(ipagecurr-1)*ipagesize&","&ipagesize
set rs=oconn.execute(resultset_sql)
case else ''其他情況按最原始的方法處理(ac同理)
set rs = server.createobject ("adodb.recordset")
resultset_sql="select "&sfield&" from "&stable&" "&scondition&" "&sorderby
rs.open resultset_sql,oconn,1,1,&h0001
rs.absoluteposition=(ipagecurr-1)*ipagesize+1
end select
s=rs.getrows(ipagesize)
rs.close
set rs=nothing
end if
resultset=s
end property
''================================================================
'' class_terminate 類注銷
''================================================================
private sub class_terminate()
if isobject(oconn) then oconn.close:set oconn=nothing
end sub
''================================================================
'' 輸入:檢查字符,是否有最小值,是否有最大值,最小值(默認數(shù)字),最大值
''================================================================
private function checknum(byval strstr,byval blnmin,byval blnmax,byval intmin,byval intmax)
dim i,s,imi,ima
s=left(trim(""&strstr),32):imi=intmin:ima=intmax
if isnumeric(s) then
i=cdbl(s)
i=iif(blnmin=1 and i
var s= new cls_jspage(<%=ireccount%>,<%=ipagesize%>,3,"s");
s.setpagese("<%=spagename%>=","");
s.setpageinput("<%=spagename%>");
s.seturl("");
s.setpagefrist("首頁","<<");
s.setpageprev("上頁","<");
s.setpagenext("下頁",">");
s.setpagelast("尾頁",">>");
s.setpagetext("[{$pagenum}]","第{$pagenum}頁");
s.setpagetextf(" {$pagetextf} "," {$pagetextf} ");
s.setpageselect("{$pagenum}","第{$pagenum}頁");
s.setpagecss("","","");
s.sethtml("共{$reccount}記錄 頁次{$page}/{$pagecount} 每頁{$pagesize}條 {$pagefrist} {$pageprev} {$pagetext} {$pagenext} {$pagelast} {$pageinput} {$pageselect}");
s.write();
<%end sub
end class%>
cls_jspage.js
/**
*=================================================================
*name: 葉子js分頁樣式(showopage style with js)
*rcsfile: cls_jspage.js
*revision: 0.09
*author: yehe(葉子)
*released: 2005-05-12 23:00:15
*description: js分頁樣式,顯示上一頁下一頁的翻頁結果
*contact: qq:311673,msn:myehe@msn.com
*website: http://www.yehe.org,http://www.showo.com
*=================================================================
*/
function cls_jspage(ireccount,ipagesize,ipagenum,sname){
this.irc=this.formatnum(ireccount,1,0,0,0);//總記錄條數(shù)
this.ips=this.formatnum(ipagesize,1,0,1,0);//每頁記錄數(shù)目
this.ipn=this.formatnum(ipagenum,0,0,0,0);//顯示的前后頁數(shù),0為顯示所有,負數(shù)為這么多頁面一個跳轉(zhuǎn)
this.sn=sname;//實例對象名
this.stpage="{$page}";//頁數(shù)
this.stpagecount="{$pagecount}";//總頁數(shù)
this.streccount="{$reccount}";//總記錄數(shù)
this.stpagesize="{$pagesize}";//每頁記錄數(shù)
this.stpagefrist="{$pagefrist}";//首頁
this.stpageprev="{$pageprev}";//上頁
this.stpagenext="{$pagenext}";//下頁
this.stpagelast="{$pagelast}";//尾頁
this.stpagetext="{$pagetext}";//數(shù)字跳轉(zhuǎn)
this.stpagetextf="{$pagetextf}";//數(shù)字跳轉(zhuǎn)框架
this.stpageinput="{$pageinput}";//輸入框跳轉(zhuǎn)
this.stpageselect="{$pageselect}";//下拉菜單跳轉(zhuǎn)
this.stpagenum="{$pagenum}";//數(shù)字頁數(shù)
this.ipc=this.getpagecount();//得到頁數(shù)
}
//輸入 頁數(shù)開始值,結尾值
cls_jspage.prototype.setpagese=function(spagestart,spageend){
var sps=spagestart,spe=spageend;
this.sps=(sps.length>0)?sps:"page=";
this.spe=(spe.length>0)?spe:"";
}
//輸入 網(wǎng)址
cls_jspage.prototype.seturl=function(surl){
var s=surl;
this.url=(s.length>0)?s:""+document.location;
}
//輸入 輸入框&下拉框name值
cls_jspage.prototype.setpageinput=function(spageinput){
var spi=spageinput;
this.spi=(spi.length>0)?spi:"page";
}
//輸入 語言 首頁(disable,enale)
cls_jspage.prototype.setpagefrist=function(sdis,sen){
this.pf_d=sdis;
this.pf_e=sen;
}
//輸入 語言 上頁
cls_jspage.prototype.setpageprev=function(sdis,sen){
this.pp_d=sdis;
this.pp_e=sen;
}
//輸入 語言 下頁
cls_jspage.prototype.setpagenext=function(sdis,sen){
this.pn_d=sdis;
this.pn_e=sen;
}
//輸入 語言 尾頁
cls_jspage.prototype.setpagelast=function(sdis,sen){
this.pl_d=sdis;
this.pl_e=sen;
}
//輸入 語言 數(shù)字跳轉(zhuǎn)
cls_jspage.prototype.setpagetext=function(sdis,sen){
this.pt_d=sdis;//"[{$pagenum}]"
this.pt_e=sen;//"第{$pagenum}頁"
}
//輸入 語言 數(shù)字跳轉(zhuǎn)外圍模板
cls_jspage.prototype.setpagetextf=function(sdis,sen){
this.ptf_d=sdis;//" {$pagetextf} "
this.ptf_e=sen;//" {$pagetextf} "
}
//輸入 語言 下拉菜單跳轉(zhuǎn)
cls_jspage.prototype.setpageselect=function(sdis,sen){
this.ps_d=sdis;//"[{$pagenum}]"
this.ps_e=sen;//"第{$pagenum}頁"
}
//輸入 css
cls_jspage.prototype.setpagecss=function(scsspagetext,scsspageinput,scsspageselect){
this.cpt=scsspagetext;//數(shù)字跳轉(zhuǎn)css
this.cpi=scsspageinput;//輸入框跳轉(zhuǎn)css
this.cps=scsspageselect;//下拉菜單跳轉(zhuǎn)css
}
//輸入 html模板
cls_jspage.prototype.sethtml=function(shtml){
this.html=shtml;//html模板
}
//計算頁數(shù)
cls_jspage.prototype.getpagecount=function(){
var irc=this.irc,ips=this.ips;
var i=(irc%ips==0)?(irc/ips):(this.formatnum((irc/ips),1,0,0,0)+1);
return (i);
}
//取得模板頁數(shù)和當前頁數(shù)
cls_jspage.prototype.geturl=function(itype){
var s=this.url,sps=this.sps,spe=this.spe,stp=this.stpage,ipc=this.ipc;
var it=itype,i;
if (s.indexof(sps)==-1) {
s+=((s.indexof("?")==-1)?"?":"&")+sps+stp;
i=1;
}
else {
sreg="(\\s.*)"+this.formatreg(sps)+"(\\d*)"+this.formatreg(spe)+"(\\s.*|\\s*)";
var spindex=this.reg(s,sreg,"$3");
s=s.replace(sps+spindex+spe,sps+stp+spe);
i=this.formatnum(spindex,1,1,0,ipc);
}
s=this.reg(s,"(&+)","&");
s=this.reg(s,"(\\?&)","?");
return (it==0?s:i);
}
//頁面跳轉(zhuǎn)
cls_jspage.prototype.pagejump=function(){
var spl,spv,sp;
var su=this.geturl(0),ipi=this.geturl(1);
var spi=this.spi,stp=this.stpage,ipc=this.ipc;
spl=document.getelementsbyname(spi).length;
for (var i=0;i
name: showopage(vbs class)
rcsfile: readme.txt
revision: 0.12.20051114.f
author: yehe(葉子)
released: 2005-11-14 09:40:13
descript: asp分頁類,支持access/mssql/mysql/sqlite
contact: qq:311673 msn:myehe@msn.com gt:mmyehe@gmail.com
website: http://www.yehe.org http://www.showo.com
------------------------------------------------
licenses:
本程序遵循gpl協(xié)議.
協(xié)議原文地址:http://www.gnu.org/licenses/licenses.cn.html#gpl
------------------------------------------------
thanks:
可洛: 感謝mssql分頁核心部分
arbiter: 感謝部分分頁思路
才子: 感謝推廣
foxty: 感謝分頁思路
------------------------------------------------
install:
1.具體調(diào)用方法可以看demo的asp文檔.
2.mssql存儲過程版的請先執(zhí)行sp_util_page.sql文件添加存儲過程.
3.sp調(diào)用方法:
exec sp_util_page 440000,4,10,''mid'',''mid,ip1,ip2,country,city'',''tbtemppage'',''1=1'',''mid asc''
記錄條數(shù)(已有值:序外部賦值,0執(zhí)行count),當前頁數(shù),每頁記錄數(shù),主鍵,字段,表,條件(不需要where),排序(不需要order by,需要asc和desc字符)
如果不按主鍵排序,則排序賦值里面不能出現(xiàn)主鍵字符.
------------------------------------------------
release:
0.12
1.取text字段類型bug修正
2.存儲過程bug修正
3.代碼修正
0.11
1.存儲過程加了非主鍵排序下的分頁
2.去掉了mssql的非存儲過程版分頁
0.10:
1.條件簡化
2.存儲過程優(yōu)化
0.09:
1.排序判斷部分優(yōu)化
0.08:
1.vbs bug修正
0.07:
1.bug修正,包括vbs類和js
0.06beta:
1.js瀏覽器兼容優(yōu)化
2.類幾個函數(shù)的bug修正
0.05beta:
1.全面代碼優(yōu)化,mysql/sqlite支持
2.參數(shù)輸入方式修改
0.04beta:
1.做到調(diào)用代碼一樣適應多種數(shù)據(jù)庫集成分頁
2.js去掉了表單,支持靜態(tài)提交
3.加上了存儲過程
0.03beta:
1.公開發(fā)布的顯示為0.02,其實為0.03,分為ac版類,mssql版類發(fā)布
2.js的bug修正
3.寫成了類,進一步方便調(diào)用
0.02beta:
1.加上對mssql的支持
2.封裝成了函數(shù)版,方便調(diào)用
3.js文件的優(yōu)化
0.01beta:
1.沒有寫成函數(shù),只是找到了比較快的ac分頁方法
2.分頁樣式用js顯示
------------------------------------------------
file:
db/ip.mdb access測試數(shù)據(jù)庫
db/ip mssql備份測試數(shù)據(jù)庫
cls_vbspage.asp 分頁類
cls_jspage.js js分頁樣式
sp_util_page.sql mssql存儲過程
demoac.asp ac分頁調(diào)用示范
demomssql.asp mssql調(diào)用示范
demomssql_sp.asp mssql存儲過程調(diào)用示范
cls_vbspage.asp
<%
class cls_vbspage
private oconn ''連接對象
private ipagesize ''每頁記錄數(shù)
private spagename ''地址欄頁數(shù)參數(shù)名
private sdbtype
''數(shù)據(jù)庫類型,ac為access,mssql為sql server2000存儲過程版,mysql為mysql,pgsql為postgresql
private irectype ''記錄總數(shù)(>0為另外取值再賦予或者固定值,0執(zhí)行count設置存cookies,-1執(zhí)行count不設置cookies)
private sjsurl ''cls_jspage.js的路徑
private sfield ''字段名
private stable ''表名
private scondition ''條件,不需要where
private sorderby ''排序,不需要order by,需要asc或者desc
private spkey ''主鍵,必寫
private ireccount
''================================================================
'' class_initialize 類的初始化
''================================================================
private sub class_initialize
ipagesize=10
spagename="page"
sdbtype="ac"
irectype=0
sjsurl=""
sfield=" * "
end sub
''================================================================
'' conn 得到數(shù)據(jù)庫連接對象
''================================================================
public property set conn(byref value)
set oconn=value
end property
''================================================================
'' pagesize 設置每一頁記錄條數(shù),默認10記錄
''================================================================
public property let pagesize(byval intpagesize)
ipagesize=checknum(intpagesize,0,0,ipagesize,0)
end property
''================================================================
'' pagename 地址欄頁數(shù)參數(shù)名
''================================================================
public property let pagename(byval strpagename)
spagename=iif(len(strpagename)<1,spagename,strpagename)
end property
''================================================================
'' dbtype 得到數(shù)據(jù)庫類型
''================================================================
public property let dbtype(byval strdbtype)
sdbtype=ucase(iif(len(strdbtype)<1,sdbtype,strdbtype))
end property
''================================================================
'' rectype 取記錄總數(shù)(>0為賦值或者固定值,0執(zhí)行count設置存cookies,-1執(zhí)行count不設置cookies適用于搜索)
''================================================================
public property let rectype(byval intrectype)
irectype=checknum(intrectype,0,0,irectype,0)
end property
''================================================================
'' jsurl 取得cls_jspage.js的路徑
''================================================================
public property let jsurl(byval strjsurl)
sjsurl=strjsurl
end property
''================================================================
'' pkey 取得主鍵
''================================================================
public property let pkey(byval strpkey)
spkey=strpkey
end property
''================================================================
'' field 取得字段名
''================================================================
public property let field(byval strfield)
sfield=iif(len(strfield)<1,sfield,strfield)
end property
''================================================================
'' table 取得表名
''================================================================
public property let table(byval strtable)
stable=strtable
end property
''================================================================
'' condition 取得條件
''================================================================
public property let condition(byval strcondition)
s=strcondition
scondition=iif(len(s)>2," where "&s,"")
end property
''================================================================
'' orderby 取得排序
''================================================================
public property let orderby(byval strorderby)
s=strorderby
sorderby=iif(len(s)>4," order by "&s,"")
end property
''================================================================
'' reccount 修正記錄總數(shù)
''================================================================
public property get reccount()
if irectype>0 then
i=irectype
elseif irectype=0 then
i=checknum(request.cookies("showopage")(spagename),1,0,0,0)
s=trim(request.cookies("showopage")("scond"))
if i=0 or scondition<>s then
i=oconn.execute("select count("&spkey&") from "&stable&" "&scondition,0,1)(0)
response.cookies("showopage")(spagename)=i
response.cookies("showopage")("scond")=scondition
end if
else
i=oconn.execute("select count("&spkey&") from "&stable&" "&scondition,0,1)(0)
end if
ireccount=i
reccount=i
end property
''================================================================
'' resultset 返回分頁后的記錄集
''================================================================
public property get resultset()
s=null
''記錄總數(shù)
i=ireccount
''當前頁
if i>0 then
ipagecount=abs(int(-abs(i/ipagesize)))''頁數(shù)
ipagecurr=checknum(request.querystring(spagename),1,1,1,ipagecount)''當前頁
select case sdbtype
case "mssql" ''sqlserver2000數(shù)據(jù)庫存儲過程版
set rs=server.createobject("adodb.recordset")
set cm=server.createobject("adodb.command")
cm.commandtype=4
cm.activeconnection=oconn
cm.commandtext="sp_util_page"
cm.parameters(1)=i
cm.parameters(2)=ipagecurr
cm.parameters(3)=ipagesize
cm.parameters(4)=spkey
cm.parameters(5)=sfield
cm.parameters(6)=stable
cm.parameters(7)=replace(scondition," where ","")
cm.parameters(8)=replace(sorderby," order by ","")
rs.cursorlocation=3
rs.locktype=1
rs.open cm
case "mysql" ''mysql數(shù)據(jù)庫
resultset_sql="select "&sfield&" from "&stable&" "&scondition&" "&sorderby&" limit "&(ipagecurr-1)*ipagesize&","&ipagesize
set rs=oconn.execute(resultset_sql)
case else ''其他情況按最原始的方法處理(ac同理)
set rs = server.createobject ("adodb.recordset")
resultset_sql="select "&sfield&" from "&stable&" "&scondition&" "&sorderby
rs.open resultset_sql,oconn,1,1,&h0001
rs.absoluteposition=(ipagecurr-1)*ipagesize+1
end select
s=rs.getrows(ipagesize)
rs.close
set rs=nothing
end if
resultset=s
end property
''================================================================
'' class_terminate 類注銷
''================================================================
private sub class_terminate()
if isobject(oconn) then oconn.close:set oconn=nothing
end sub
''================================================================
'' 輸入:檢查字符,是否有最小值,是否有最大值,最小值(默認數(shù)字),最大值
''================================================================
private function checknum(byval strstr,byval blnmin,byval blnmax,byval intmin,byval intmax)
dim i,s,imi,ima
s=left(trim(""&strstr),32):imi=intmin:ima=intmax
if isnumeric(s) then
i=cdbl(s)
i=iif(blnmin=1 and i
var s= new cls_jspage(<%=ireccount%>,<%=ipagesize%>,3,"s");
s.setpagese("<%=spagename%>=","");
s.setpageinput("<%=spagename%>");
s.seturl("");
s.setpagefrist("首頁","<<");
s.setpageprev("上頁","<");
s.setpagenext("下頁",">");
s.setpagelast("尾頁",">>");
s.setpagetext("[{$pagenum}]","第{$pagenum}頁");
s.setpagetextf(" {$pagetextf} "," {$pagetextf} ");
s.setpageselect("{$pagenum}","第{$pagenum}頁");
s.setpagecss("","","");
s.sethtml("共{$reccount}記錄 頁次{$page}/{$pagecount} 每頁{$pagesize}條 {$pagefrist} {$pageprev} {$pagetext} {$pagenext} {$pagelast} {$pageinput} {$pageselect}");
s.write();
<%end sub
end class%>
cls_jspage.js
/**
*=================================================================
*name: 葉子js分頁樣式(showopage style with js)
*rcsfile: cls_jspage.js
*revision: 0.09
*author: yehe(葉子)
*released: 2005-05-12 23:00:15
*description: js分頁樣式,顯示上一頁下一頁的翻頁結果
*contact: qq:311673,msn:myehe@msn.com
*website: http://www.yehe.org,http://www.showo.com
*=================================================================
*/
function cls_jspage(ireccount,ipagesize,ipagenum,sname){
this.irc=this.formatnum(ireccount,1,0,0,0);//總記錄條數(shù)
this.ips=this.formatnum(ipagesize,1,0,1,0);//每頁記錄數(shù)目
this.ipn=this.formatnum(ipagenum,0,0,0,0);//顯示的前后頁數(shù),0為顯示所有,負數(shù)為這么多頁面一個跳轉(zhuǎn)
this.sn=sname;//實例對象名
this.stpage="{$page}";//頁數(shù)
this.stpagecount="{$pagecount}";//總頁數(shù)
this.streccount="{$reccount}";//總記錄數(shù)
this.stpagesize="{$pagesize}";//每頁記錄數(shù)
this.stpagefrist="{$pagefrist}";//首頁
this.stpageprev="{$pageprev}";//上頁
this.stpagenext="{$pagenext}";//下頁
this.stpagelast="{$pagelast}";//尾頁
this.stpagetext="{$pagetext}";//數(shù)字跳轉(zhuǎn)
this.stpagetextf="{$pagetextf}";//數(shù)字跳轉(zhuǎn)框架
this.stpageinput="{$pageinput}";//輸入框跳轉(zhuǎn)
this.stpageselect="{$pageselect}";//下拉菜單跳轉(zhuǎn)
this.stpagenum="{$pagenum}";//數(shù)字頁數(shù)
this.ipc=this.getpagecount();//得到頁數(shù)
}
//輸入 頁數(shù)開始值,結尾值
cls_jspage.prototype.setpagese=function(spagestart,spageend){
var sps=spagestart,spe=spageend;
this.sps=(sps.length>0)?sps:"page=";
this.spe=(spe.length>0)?spe:"";
}
//輸入 網(wǎng)址
cls_jspage.prototype.seturl=function(surl){
var s=surl;
this.url=(s.length>0)?s:""+document.location;
}
//輸入 輸入框&下拉框name值
cls_jspage.prototype.setpageinput=function(spageinput){
var spi=spageinput;
this.spi=(spi.length>0)?spi:"page";
}
//輸入 語言 首頁(disable,enale)
cls_jspage.prototype.setpagefrist=function(sdis,sen){
this.pf_d=sdis;
this.pf_e=sen;
}
//輸入 語言 上頁
cls_jspage.prototype.setpageprev=function(sdis,sen){
this.pp_d=sdis;
this.pp_e=sen;
}
//輸入 語言 下頁
cls_jspage.prototype.setpagenext=function(sdis,sen){
this.pn_d=sdis;
this.pn_e=sen;
}
//輸入 語言 尾頁
cls_jspage.prototype.setpagelast=function(sdis,sen){
this.pl_d=sdis;
this.pl_e=sen;
}
//輸入 語言 數(shù)字跳轉(zhuǎn)
cls_jspage.prototype.setpagetext=function(sdis,sen){
this.pt_d=sdis;//"[{$pagenum}]"
this.pt_e=sen;//"第{$pagenum}頁"
}
//輸入 語言 數(shù)字跳轉(zhuǎn)外圍模板
cls_jspage.prototype.setpagetextf=function(sdis,sen){
this.ptf_d=sdis;//" {$pagetextf} "
this.ptf_e=sen;//" {$pagetextf} "
}
//輸入 語言 下拉菜單跳轉(zhuǎn)
cls_jspage.prototype.setpageselect=function(sdis,sen){
this.ps_d=sdis;//"[{$pagenum}]"
this.ps_e=sen;//"第{$pagenum}頁"
}
//輸入 css
cls_jspage.prototype.setpagecss=function(scsspagetext,scsspageinput,scsspageselect){
this.cpt=scsspagetext;//數(shù)字跳轉(zhuǎn)css
this.cpi=scsspageinput;//輸入框跳轉(zhuǎn)css
this.cps=scsspageselect;//下拉菜單跳轉(zhuǎn)css
}
//輸入 html模板
cls_jspage.prototype.sethtml=function(shtml){
this.html=shtml;//html模板
}
//計算頁數(shù)
cls_jspage.prototype.getpagecount=function(){
var irc=this.irc,ips=this.ips;
var i=(irc%ips==0)?(irc/ips):(this.formatnum((irc/ips),1,0,0,0)+1);
return (i);
}
//取得模板頁數(shù)和當前頁數(shù)
cls_jspage.prototype.geturl=function(itype){
var s=this.url,sps=this.sps,spe=this.spe,stp=this.stpage,ipc=this.ipc;
var it=itype,i;
if (s.indexof(sps)==-1) {
s+=((s.indexof("?")==-1)?"?":"&")+sps+stp;
i=1;
}
else {
sreg="(\\s.*)"+this.formatreg(sps)+"(\\d*)"+this.formatreg(spe)+"(\\s.*|\\s*)";
var spindex=this.reg(s,sreg,"$3");
s=s.replace(sps+spindex+spe,sps+stp+spe);
i=this.formatnum(spindex,1,1,0,ipc);
}
s=this.reg(s,"(&+)","&");
s=this.reg(s,"(\\?&)","?");
return (it==0?s:i);
}
//頁面跳轉(zhuǎn)
cls_jspage.prototype.pagejump=function(){
var spl,spv,sp;
var su=this.geturl(0),ipi=this.geturl(1);
var spi=this.spi,stp=this.stpage,ipc=this.ipc;
spl=document.getelementsbyname(spi).length;
for (var i=0;i
id 標題 內(nèi)容(顯示前20個字) 時間 <% dim ors set ors=new cls_vbspage ''創(chuàng)建對象 set ors.conn=conn ''得到數(shù)據(jù)庫連接對象 with ors .pagesize=13 ''每頁記錄條數(shù) .pagesize=13 ''每頁記錄條數(shù) .pagename="pages" ''cookies名稱 .dbtype="mssql" ''數(shù)據(jù)庫類型,ac為access,mssql為sqlserver2000存儲過程版,mysql為mysql,pgsql為postgresql .rectype=0 ''記錄總數(shù)(>0為另外取值再賦予或者固定值,0執(zhí)行count設置存cookies,-1執(zhí)行count不設置cookies) .jsurl="" ''cls_jspage.js的路徑 .pkey="mid" ''主鍵 .field="mid,ip2,country,city" .table="tbtemppage" .condition="" ''條件,不需要where .orderby="mid asc" ''排序,不需要order by,需要asc或者desc end with ireccount=ors.reccount()''記錄總數(shù) irs=ors.resultset() ''返回resultset if ireccount<1 then%> |
暫無記錄 <% else for i=0 to ubound(irs,2)%> |
<%endtime=timer()%> 本頁面執(zhí)行時間:<%=formatnumber((endtime-startime)*1000,3)%>毫秒 <% irs=null ors=null set ors=nothing %> |
相關文章
- ASP怎么談到應用到類的?
- 檢測函數(shù) asp class
- 遭遇ASP類的事件設計
- ASP高亮類
- Object對象的一些的隱藏函數(shù)介紹
- 淺談ASP中的類
- 在VBScript中使用類
- ASP 類專題
- 代碼與頁面的分離
- ASP代碼的對象化
- 一個asp快速字符串連接類
- 一個簡單的asp數(shù)據(jù)庫操作類
- ASP類編寫詳細說明
- 實現(xiàn)支持邏輯搜索/單詞搜索/詞組搜索+支持OR/AND關鍵字的VBS CLASS!
- ASP類Class入門 推薦
- 創(chuàng)建一個ASP通用分頁類
- 如何編寫一個ASP類
- 一個ACCESS數(shù)據(jù)庫訪問的類第1/3頁
- 分頁類,異常類
- ASP 類 Class入門