comcls.asp
来自「足球推荐程序 功能齐全 还 不错 界面漂亮 容易修改」· ASP 代码 · 共 300 行
ASP
300 行
<%
'公共函數,過程類
Dim RowCount,weekary(7)
weekary(1)="星期日"
weekary(2)="星期一"
weekary(3)="星期二"
weekary(4)="星期三"
weekary(5)="星期四"
weekary(6)="星期五"
weekary(7)="星期六"
Class FunctionClass
Function MessageToUrl(n)'傳輸信息
If n="" Then
Response.Write "<script language=javascript>alert('提示:MessageToUrl參數為空!');</script>"
Response.End
Else
Response.Write"<a href='"&n&"'><span>返回</span></a>"
End If
End Function
'=============================================================
Public Sub GoToUrl(Url)'網頁跳轉
Response.Redirect(Url)
End Sub
'=============================================================
'---------------------------------------------------------------------------
Public Function UDPpageshow(total,pagecountnum,pagenum,page,typeid)'SQLstr sql查询语句,curpage ,当前页数,pagenum每页大小 ,curpage当前页数,total记录总数,pagecountnum分页总数
Dim pagestrtemp
If page=1 then
pagestrtemp=pagestrtemp&"首页 | 上一页"
Else
pagestrtemp=pagestrtemp&"<a href='Javascript:GoPage(1,"&typeid&");'>首页</a> | <a href='Javascript:GoPage("&Page-1&","&typeid&");'>上一页</a>"
End If
pagestrtemp=pagestrtemp&" | "
If Cint(page)>=Cint(pagecountnum) Then
pagestrtemp=pagestrtemp&"下一页 | 尾页"
Else
pagestrtemp=pagestrtemp&"<a href='Javascript:GoPage("&Page+1&","&typeid&");'>下一页</a> | <a href='Javascript:GoPage("&pagecountnum&","&typeid&");'>尾页</a>"
End If
pagestrtemp=pagestrtemp&" | 位于"&page&"/"&pagecountnum&"页"
UDPpageshow=pagestrtemp
End Function
'===============================================================
Public Sub JavaScriptGoToUrl(Url)'客戶端網頁跳轉
Response.write "<script language=javascript>window.location='"&Url&"';</script>"
End Sub
'=============================================================
'=============================================================
Sub ErrMessage(StrErr)'捕捉後台代碼出錯
If Trim(StrErr)="" Then
Response.Write "<script language=javascript>alert('提示:ErrMessage參數為空!');</script>"
Response.End
Else
Response.Write "<script language=javascript>alert('"&StrErr&"');</script>"
Response.End
End If
End Sub
'=============================================================
Public Sub MessAgeShowDialog(StrVal)'提示信息返回原來的網頁
Response.Write"<script lanuage=Javascript>alert('"&StrVal&"');history.go(-1);</script>"
Response.end
End Sub
'=============================================================
Public Sub ShowMessAge(StrVal)'提示
Response.Write"<script lanuage=Javascript>alert('"&StrVal&"');</script>"
End Sub
'==================================================================
function Showpage()'
'Showpagebody= "<table width=100% ><tr><td>"
Showpagebody=Showpagebody& "共<font color=#FF0000>"&AdoRs.recordcount&"</font>条记录"
Showpagebody=Showpagebody&" "
Showpagebody=Showpagebody&"分<font color=#FF0000>"&AdoRs.pagecount&"</font>页"
Showpagebody=Showpagebody&" "
Showpagebody=Showpagebody&"每页<font color=#FF0000>"&AdoRs.pagesize&"</font>条 "
Showpagebody=Showpagebody&" 当前是第<font color=#FF0000>"&page&"</font>页 "
If page=1 then
Showpagebody=Showpagebody&"<a>首页</a> <a>上一页</a>"
Else
Showpagebody=Showpagebody&"<a href='Javascript:GoPage(1);'>首页</a> <a href='Javascript:GoPage("&Page-1&");'>上一页</a>"
End If
Showpagebody=Showpagebody&" "
If Cint(page)=Cint(AdoRs.pagecount) Then
Showpagebody=Showpagebody&"<a>下一页</a> <a>尾页</a>"
Else
Showpagebody=Showpagebody&"<a href='Javascript:GoPage("&Page+1&");'>下一页</a> <a href='Javascript:GoPage("&AdoRs.Pagecount&");'>尾页</a>"
End If
Showpagebody=Showpagebody&" "
Showpage=Showpagebody
End function
'---------------------------------------------------------------
Public sub divpage(recordno,pagereq)
AdoRs.pagesize=recordno
page=1
if pagereq="" then
pagereq=""
end if
if pagereq<>"" then
page=pagereq
if Cint(pagereq)<1 then page=1
if Cint(pagereq)>Cint(AdoRs.pagecount) then page=AdoRs.pagecount
end if
AdoRs.absolutepage=page
rowcount=AdoRs.pagesize
end sub
'----------------------------------------------------------------
function Showpageindex()'
'Showpagebody= "<table width=100% ><tr><td>"
Showpagebody=Showpagebody& "共<font color=#FF0000>"&AdoRs.recordcount&"</font>条记录"
Showpagebody=Showpagebody&" "
Showpagebody=Showpagebody&"分<font color=#FF0000>"&AdoRs.pagecount&"</font>页"
Showpagebody=Showpagebody&" "
Showpagebody=Showpagebody&"每页<font color=#FF0000>"&AdoRs.pagesize&"</font>条 "
Showpagebody=Showpagebody&" 当前是第<font color=#FF0000>"&page&"</font>页 "
If page=1 then
Showpagebody=Showpagebody&"<a>首页</a> <a>上一页</a>"
Else
Showpagebody=Showpagebody&"<a href='Javascript:GoPage(1);'><font color=red>首页</font></a> <a href='Javascript:GoPage("&Page-1&");'><font color=red>上一页</font></a>"
End If
Showpagebody=Showpagebody&" "
If Cint(page)=Cint(AdoRs.pagecount) Then
Showpagebody=Showpagebody&"<a>下一页</a> <a>尾页</a>"
Else
Showpagebody=Showpagebody&"<a href='Javascript:GoPage("&Page+1&");'><font color=red>下一页</font></a> <a href='Javascript:GoPage("&AdoRs.Pagecount&");'><font color=red>尾页</font></a>"
End If
Showpagebody=Showpagebody&" "
Showpageindex=Showpagebody
End function
'-----------------------------------------------------------
function Showpageindex2()'
'Showpagebody= "<table width=100% ><tr><td>"
Showpagebody=Showpagebody& "共<font color=#FF0000>"&AdoRs.recordcount&"</font>条记录"
Showpagebody=Showpagebody&" "
Showpagebody=Showpagebody&"分<font color=#FF0000>"&AdoRs.pagecount&"</font>页"
Showpagebody=Showpagebody&" "
Showpagebody=Showpagebody&"每页<font color=#FF0000>"&AdoRs.pagesize&"</font>条 "
Showpagebody=Showpagebody&" 当前是第<font color=#FF0000>"&page&"</font>页 "
If page=1 then
Showpagebody=Showpagebody&"<a>首页</a> <a>上一页</a>"
Else
Showpagebody=Showpagebody&"<a href='Javascript:GoPage2(1);'><font color=red>首页</font></a> <a href='Javascript:GoPage2("&Page-1&");'><font color=red>上一页</font></a>"
End If
Showpagebody=Showpagebody&" "
If Cint(page)=Cint(AdoRs.pagecount) Then
Showpagebody=Showpagebody&"<a>下一页</a> <a>尾页</a>"
Else
Showpagebody=Showpagebody&"<a href='Javascript:GoPage2("&Page+1&");'><font color=red>下一页</font></a> <a href='Javascript:GoPage2("&AdoRs.Pagecount&");'><font color=red>尾页</font></a>"
End If
Showpagebody=Showpagebody&" "
Showpageindex2=Showpagebody
End function
'=============================================================
Public Sub SetAdoCn(Obj,AdoSQL)
Set Obj=Server.CreateObject("AdoDb.ConNection")
Obj.Open AdoSQL
End Sub
Public Sub SetAdoRs(Obj)
Set Obj=Server.CreateObject("Adodb.RecordSet")
End Sub
Public Sub AdoRsClose(Obj)
If Obj.State=1 Then
Obj.Close
End If
End Sub
Public Sub AdoRsNothing(Obj)
If Not Obj Is Nothing Then
Set Obj=Nothing
End If
End Sub
Public Sub AdoCnNothing(Obj)
If Obj.State=1 Then
Obj.Close
End If
If Not Obj Is Nothing Then
Set Obj=Nothing
End If
End Sub
'-----------------------------------------------------------------
Public function sift_javascript(Content)'过滤javascrpt
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern ="<script.*</script>" ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分大小写。
sift_javascript = regEx.Replace(Content, "")
End function
'----------------------------------------------------------------
public function sift_html(Content) '过滤html
Set regEx = New RegExp ' 建立正则表达式。
'regEx.Pattern ="/<(.*)>.*<\/\1>|<(.*) \/>/" ' 设置模式。
regEx.Pattern ="(<[a-zA-Z].*?>)|(<[\/][a-zA-Z].*?>)"
regEx.IgnoreCase = True ' 设置是否区分大小写。
sift_html = regEx.Replace(Content,"")
end function
'---------------------------------------------------------------
Public Function Sift_Str(StrVal,mType)'1数值2-字符串
Dim Str
If mTYpe=1 Then
If Not IsNumeric(StrVal) Then
Sift_Str=0
Else
Sift_str=StrVal
End If
Else
Dim TempAry
Str=" or ,',delete ,update , where ,select ,inser , declare , - , @,$,<,>"
TempAry=Split(Str,",")
Sift_Str=StrVal
For i=0 To Ubound(TempAry)
Sift_str=Trim(Replace(Sift_Str,TempAry(i),""))
Next
End If
End Function
'-------------------------------------------------------------
public function InterceptString(Str,StrNum) 'str 需截取的字符串,StrNum截取多少个字符串
if len(str)>strnum then
interceptstring=mid(str,1,strnum)
else
interceptstring=str
end if
end function
'----------------------------------------------------------
public function Sift_href(strVal)
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="\<a (.*)\>(.*)</a>"
Sift_href=re.Replace(strVal,"")'去掉超级链接
end function
'------------------------------------------------------------
function chdate(datestr)'10月07日 21:00
yearstr=mid(year(datestr),3,2)
monthstr=month(datestr)
if monthstr<10 then
monthstr="0"&monthstr
end if
daystr=day(datestr)
if daystr<10 then
daystr="0"&daystr
end if
mTime=TimeValue(datestr)
mTimeAry=split(mTime,":")
if mTimeAry(0)<10 then
mTimeAry(0)="0"&mTimeAry(0)
end if
if instr(mTimeAry(1),":")<1 then
else
mTimeAry(1)=Replace(mTimeAry(1),":","")
end if
chdate=monthstr&"月"&daystr&"日 "& mTimeAry(0)&":"&mTimeAry(1)
end function
'-------------------------------------------------------
function chdate2(datestr)'07-08-01
yearstr=mid(year(datestr),3,2)
monthstr=month(datestr)
if monthstr<10 then
monthstr="0"&monthstr
end if
daystr=day(datestr)
if daystr<10 then
daystr="0"&daystr
end if
chdate2=monthstr&"月"&daystr&"日"
end function
'-------------------------------------------------------------
function chdate3(datestr)'09/16/07 02:22
yearstr=mid(year(datestr),3,2)
monthstr=month(datestr)
if monthstr<10 then
monthstr="0"&monthstr
end if
daystr=day(datestr)
if daystr<10 then
daystr="0"&daystr
end if
mTime=TimeValue(datestr)
mTimeAry=split(mTime,":")
if mTimeAry(0)<10 then
mTimeAry(0)="0"&mTimeAry(0)
end if
if instr(mTimeAry(1),":")<1 then
else
mTimeAry(1)=Replace(mTimeAry(1),":","")
end if
chdate3=monthstr&"/"&daystr&"/"&yearstr&" "& mTimeAry(0)&":"&mTimeAry(1)
end function
'=============================================================
End Class
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?