?? check_function.asp
字號:
<%
'+------------------------------------------------------------------+
'|str1為從表單中傳遞過來的內容 |
'|str2為所在表單內容屬性 |
'|str3為最長的字符長度 |
'|str4為是否允許表單內容為空,0為不能為空,1為允許為空 |
'+------------------------------------------------------------------+
function check_len(str1,str2,str3,str4)
str1=trim(str1)
if str4=0 then
if str1="" then
errmsg=errmsg & "<br><li>" & str2 & "-->不能為空</li>"
check_len=true
elseif len(str1)>str3 then
errmsg=errmsg & "<br><li>" & str2 & "-->長度不能超過</li>" & str3 & "位"
check_len=true
end if
elseif str4=1 and len(str1)>str3 then
errmsg=errmsg & "<br><li>" & str2 & "-->長度不能超過</li>" & str3 & "位"
check_len=true
end if
end function
'+------------------------------------------------------------------+
'|此函數為檢測提交表單的內容最小的字數 |
'|str1為從表單中傳遞過來的內容 |
'|str2為所在表單內容的最小數值 |
'+------------------------------------------------------------------+
function check_small_len(str1,str2,str3)
str1=trim(str1)
if len(str1)<str3 then
errmsg=errmsg & "<br><li>" & str2 & "-->長度不能小于</li>" & str3 & "位"
check_small_len=true
end if
end function
'+------------------------------------------------------------------+
'|str1為從表單中傳遞過來的內容 |
'|str2為所在表單內容屬性 |
'|如果表單提交的內容不為數字則返回check_num=true,即有錯誤 |
'+------------------------------------------------------------------+
function check_num(str1,str2)
str1=trim(str1)
if not isnumeric(str1) then
errmsg=errmsg & "<br><li>" & str2 & "-->應為數字</li>"
check_num=true
end if
end function
Function convert(str1)
on Error resume next
str1 = Replace(str1, "<", "<")
str1 = Replace(str1, ">", ">")
str1 = Replace(str1, CHR(10) & CHR(10), "</P><P>")
str1 = Replace(str1, CHR(10), "<BR>")
str1 = Replace(str1,"'","''")
FormatStr = str1
End Function
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -