函数|函数
文章来源: 视点设计 8see.net
http://blog.8see.net/
rem ---表单提示函数 Being-----------------------------
CODE Copy ...
Function Check_submit(str,restr)
if str="" then
response.write "<script>"
response.write "alert('"&restr&"');"
response.write "history.go(-1)"
response.write "</script>"
response.end
else
Check_submit=str
end if
End Function
CODE Copy ...
Function Alert_submit(str)
response.write "<script>"
response.write "alert('"&str&"');"
'response.write "location.reload();"
response.write "</script>"
End Function
CODE Copy ...
Function localhost_submit(str,urls)
response.write "<script>"
if str<>"" then
response.write "alert('"&str&"');"
end if
response.write "location='"&urls&"';"
response.write "</script>"
End Function
rem ---生成自定义位随机数 Being-----------------------------
CODE Copy ...
Function makerndid(byVal maxLen)
Dim strNewPass
Dim whatsNext, upper, lower, intCounter
RANdomize
For intCounter = 1 To maxLen
whatsNext = int(2 * Rnd)
If whatsNext = 0 Then
upper = 80
lower = 70
Else
upper = 48
lower = 39
End If
strNewPass = strNewPass & Chr(Int((upper - lower + 1) * Rnd + upper))
Next
makerndid = strNewPass
End Function
rem ---生成四位随机数 Being-----------------------------
CODE Copy ...
Function get_rand()
dim num1
dim rndnum
Randomize
Do While Len(rndnum)<4
num1=CStr(Chr((57-48)*rnd+48))
rndnum=rndnum&num1
loop
get_rand=rndnum
End Function
rem ---判断数据是否整型 Being-----------------------------
CODE Copy ...
Function IsInteger(para)
on error resume next
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
rem ---数据库链接函数 Being-----------------------------
CODE Copy ...
Function OpenCONN
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DB_login)
conn.Open connstr
End Function
rem ---中文字符转Uncode代码函数 Being-----------------------------
CODE Copy ...
Function URLEncoding(vstrIn)
strReturn = ""
For i = 1 To Len(vstrIn)
ThisChr = Mid(vStrIn,i,1)
If Abs(Asc(ThisChr)) < &HFF Then
strReturn = strReturn & ThisChr
Else
innerCode = Asc(ThisChr)
If innerCode < 0 Then
innerCode = innerCode + &H10000
End If
Hight8 = (innerCode And &HFF00)\ &HFF
Low8 = innerCode And &HFF
strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8)
End If
Next
URLEncoding = strReturn
End Function
rem ---Html过滤函数 Being-----------------------------Function Htmlout(str)
CODE Copy ...
dim result
dim l
if isNULL(str) then
Htmlout=""
exit function
end if
l=len(str)
result=""
dim i
for i = 1 to l
select case mid(str,i,1)
case "<"
result=result+"<"
case ">"
result=result+">"
case chr(13)
if session("admin_system")="" then
result=result+"<br>"
end if
case chr(34)
result=result+"""
case "&"
result=result+"&"
case chr(32)
'result=result+" "
if i+1<=l and i-1>0 then
if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or m