常用ASP自定義函數(shù)全集_ASP教程
推薦:解讀ASP常見錯誤類型大全ActiveServerPages,ASP0126(0x80004005)--找不到包含文件 MicrosoftOLEDBProviderforODBCDrivers(0x80040E21)--sql語句出錯(數(shù)據(jù)類型不匹配或表名(字段名)錯誤或表處于編輯狀態(tài),或表不存在于conn打開的數(shù)據(jù)庫中) MicrosoftOLEDBProviderforODBCDrivers(0x800
<% 分享:ASP實(shí)現(xiàn)長文章手動分頁的代碼% setrecordset1=server.createobject(adodb.recordset) exec=SELECT*FROMnewswhereid=id recordset1.Openexec,conn,1,1 % tablewidth=85%border=0align=centercellpadding=3cellspacing=0 trtd ....... % IfRequest(page)=Then pageNum=0
'========================================================
'函數(shù)導(dǎo)航
'FormatDate(DT,tp) ------------------------------------------日期格式化
'IsInteger(para) ---------------------------檢測傳遞的參數(shù)是否為數(shù)字型
'ChkrequestDate(Para) -----------------------檢測傳遞的參數(shù)是否為日期型
'ChkPost() ------------------------------------不允許外部提交數(shù)據(jù)的選擇
'IsValidEmail(email)------------------------------------------Email檢測
'MakedownName()--------------------------------構(gòu)造上傳圖片文件名隨機(jī)數(shù)
'getIP() ----------------------------------------------------獲取IP地址
'LeftTrue(str,n)---------------------------------------字符個數(shù)統(tǒng)一顯示
'CheckSql()-為了系統(tǒng)的安全,直接在有數(shù)據(jù)庫連接的地方都加上SQL注入的免疫
'Runtime()---------------------------------------------程序執(zhí)行時(shí)間檢測
'--------------------FSO文件|文件夾操作--------------------------------
'Checkfolder(folderpath)-------------------------------------創(chuàng)建文件夾
'Deletefolder(folderpath) -----------------------------------刪除文件夾
'Filehaveno(FileName) ---------------------------------判斷文件是否存在
'readfilerecord(Filename) -----------將指定的文件內(nèi)容讀出|只能是txt文本
'WriteString(String,FileName)------------把指定的字符串寫到指定新文件中
'--------------------進(jìn)制轉(zhuǎn)化|加密|------------------------------------
'Encrypt(theNumber)| Decrypt(theNumber) 一套加解密ID的函數(shù),最多8位
'UTF2GB(UTFStr) -------------------------將UTF8編碼文字轉(zhuǎn)換為GB編碼文字
'toUTF8(szInput)-------------------------將GB編碼文字轉(zhuǎn)換為UTF8編碼文字
'c10to2(x)-----------------------------------十進(jìn)制代碼轉(zhuǎn)換為二進(jìn)制代碼
'c16to2(x)---------------------------------十六進(jìn)制代碼轉(zhuǎn)換為二進(jìn)制代碼
'c2to16(x)---------------------------------二進(jìn)制代碼轉(zhuǎn)換為十六進(jìn)制代碼
'c2to10(x)-----------------------------------二進(jìn)制代碼轉(zhuǎn)換為十進(jìn)制代碼
'=========================================================
%>
<%
StartTime=timer()
'日期格式化
Function FormatDate(DT,tp)
dim Y,M,D
Y=Year(DT)
M=month(DT)
D=Day(DT)
if M<10 then M="0"&M
if D<10 then D="0"&D
select case tp
case 1 FormatDate=Y&"年"&M&"月"&D&"日"
case 2 FormatDate=Y&"/"&M&"/"&D
case 3 FormatDate=M&"/"&D
case 4 FormatDate=Y&"\"&M&"\"&D
case 5 FormatDate=Y&"-"&M&"-"&D
end select
End Function
'--------------------------------
' ---判斷數(shù)據(jù)是否整型 Being-----------------------------
Function IsInteger(para)
dim str
dim l,i
if isNUll(para) then
isInteger=false
exit function
end if
str=cstr(para)
if trim(str)="" then
isInteger=false
exit function
end if
l=len(str)
for i=1 to l
if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
isInteger=false
exit function
end if
next
isInteger=true
if err.number<>0 then err.clear
End Function
'--------------------------------
'檢測傳遞的參數(shù)是否為日期型
Function ChkrequestDate(Para)
ChkrequestDate=False
If Not (IsNull(Para) Or Trim(Para)="" Or Not IsDate(Para)) Then
ChkrequestDate=True
End If
End Function
'--------------------------------
- asp FSO 讀寫文件本文件實(shí)現(xiàn)代碼
- asp中isNull、isEmpty和空字符串的區(qū)別
- asp獲取用戶真實(shí)IP地址的方法
- asp連接sqlserver數(shù)據(jù)庫實(shí)現(xiàn)代碼
- asp中正則表達(dá)式過濾html代碼函數(shù)
- asp中g(shù)et post提交表單區(qū)別
- 網(wǎng)頁模板:ASP內(nèi)建對象Request
- xmlhttp的open方法使用詳解
- ASP的常用的自定義函數(shù)大全
- asp中用for循環(huán)的一個小技巧
- eWebEditor v3.8 列目錄
- ASP無組件分頁實(shí)現(xiàn)思路及代碼
- 相關(guān)鏈接:
- 教程說明:
ASP教程-常用ASP自定義函數(shù)全集。