⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 check_function.asp

📁 fdafaf af
💻 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, "<", "&lt;")
  str1 = Replace(str1, ">", "&gt;")
  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 + -