elect,PSelect);
document.write (s);
}
//输入:欲格式化字符,是否有最小值(0表示没有,1表示有),是否有最大值,最小值(默认值),最大值
Cls_jsPage.prototype.FormatNum=function(sNum,bMin,bMax,iMinNum,iMaxNum){
var i,iN,sN=""+sNum,iMin=iMinNum,iMax=iMaxNum;
if (sN.length>0) {
iN=parseInt(sN,10);
i=(isNaN(iN))?iMin:iN;
i=(i<iMin&&bMin==1)?iMin:i;
i=(i>iMax&&bMax==1)?iMax:i;
}
else {
i=iMin;
}
return (i);
}
//输入:欲正则字符,正则表达式,替换后字符
Cls_jsPage.prototype.Reg=function(sStr,sReg,sRe){
var s="",sS=sStr,sR=sReg,sRe=sRe;
if ((sS.length>0)&&(sR.length>0)) {
eval("re=/"+sR+"/gim;");
s=sS.replace(re,sRe);
}
return (s);
}
//格式化正则中的特殊字符
Cls_jsPage.prototype.FormatReg=function(sReg){
var s="",sR=sReg;
var sF=new Array ("/",".","+","[","]","{","}","$","^","?","*");
if (sR.length>0) {
for (var i=0;i<=sF.length;i++) {
sR=sR.replace(sF[i],"\\"+sF[i]);
}
s="("+sR+")";
}
return (s);
}
demoAC.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Cls_vbsPage.asp"-->
<%
''''-----------------------------------------------------------------------------------------------
On Error Resume Next
DIM startime,endtime
''''统计执行时间
startime=timer()
''''连接数据库
DIM Db,Conn,Rs
Db = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/IP.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open Db
''''-----------------------------------------------------------------------------------------------
%>
<html>
<head>
<title>叶子ASP分页类-access调用示范</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
table { font-size: 12px}
a { font-size: 12px; color: #000000; text-decoration: none}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="760" border="0" cellspacing="2" cellpadding="2" align="center" height="30">
<tr>
<td> </td>
</tr>
</table>
<table width="760" border="1" cellspacing="0" cellpadding="4" align="center" bordercolordark="#FFFFFF" bordercolorlight="#CCCCCC">
<tr align="center">
<td width="20">ID</td>
<td>标题</td>
<td>内容(显示前20个字)</td>
<td>时间</td>
</tr>
<%
Dim ors
Set ors=new Cls_vbsPage ''''创建对象
Set ors.Conn=conn ''''得到数据库连接对象
With ors
.PageSize=13 ''''每页记录条数
.PageName="Pages" ''''cookies名称
.DbType="AC"
''''数据库类型,AC为access,MSSQL为sqlserver2000存储过程版,MYSQL为mysql,PGSQL为PostGreSql
.RecType=0
''''记录总数(>0为另外取值再赋予或者固定值,0执行count设置存cookies,-1执行count不设置cookies)
.JsUrl="" ''''Cls_jsPage.js的路径
.Pkey="MID" ''''主键
.Field="MID,ip2,country,city"
.Table="dv_address"
.Condition="" ''''条件,不需要where
.OrderBy="MID DESC" ''''排序,不需要order by,需要asc或者desc
End With
iRecCount=ors.RecCount()''