upper = 90
lower = 65
ELSE
upper = 57
lower = 48
END IF
strNewPass = strNewPass & Chr(Int((upper - lower + 1) * Rnd + lower))
Next
makePassword = strNewPass
End Function
'Response.Write makepassword(8)
%>
#T= 填入Textarea时保持格式inHTML
<%
'===============================================================
'去除Html格式,用于从数据库中取出值填入输入框时
'注意:value="?"这边一定要用双引号
'===============================================================
Function inHTML(str)
Dim sTemp
sTemp = str
inHTML = ""
If IsNull(sTemp) = True Then
Exit Function
End If
sTemp = Replace(sTemp, "&", "&")
sTemp = Replace(sTemp, "<br>",chr(13))
sTemp = Replace(sTemp, "<", "<")
sTemp = Replace(sTemp, ">", ">")
sTemp = Replace(sTemp, """, Chr(34))
inHTML = sTemp
End Function
%>
#T= 正则表表达式验证函数
<%
'正则表表达式验证函数 patrn-正则表达式 strng-需要验证的字符串
'===============================================================
Function RegExpTest(patrn, strng)
Dim regEx, retVal ' 建立变量。
SET regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = False ' 设置是否区分大小写。
retVal = regEx.Test(strng) ' 执行搜索测试。
RegExpTest = retVal '返回值,不符合就返回false,符合为true
SET regEx = NOTHING
End Function
%>
#T= 生成随机字符串
<%
'生成随机字符串
Function RndCode()
Dim CodeSet,AmountSet
CodeSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
AmountSet = 62 ' 文字数量
Randomize
Dim vCode(10), vCodes,i
For i = 0 To 9
vCode(i) = Int(Rnd * AmountSet)
vCodes = vCodes & Mid(CodeSet, vCode(i) + 1, 1)