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

📄 functionchar.asp

📁 政府网站集成OA办公考勤新闻发布网站信息管理会员管理
💻 ASP
字号:
<%
Rem 防sql注入
function HX_Replace(str)
    if not isnull(str) and str<>"" then
	str	= Replace(str,"&","&amp;")	
	str = replace(str, ">", "&gt;")
	str = replace(str, "<", "&lt;")
	str = Replace(str, CHR(32), " ")
	str = Replace(str, CHR(9), "&nbsp;")
	str = Replace(str, CHR(34), "&quot;")
	str = Replace(str, CHR(39), "&#39;")
	str = Replace(str, CHR(13), "")
	str = Replace(str, "script", "&#115;cript")
	str = Replace(str, "&#115;", "&#115;")
    HX_Replace = str
   end if
end function

Function isInt(str)
    Dim L,I
    isInt=False
    If Trim(Str)="" Or IsNull(str) Then Exit Function
    str=CStr(Trim(str))
    L=Len(Str) 
    For I=1 To L
    If Mid(Str,I,1)>"9" Or Mid(Str,I,1)<"0" Then Exit Function
    Next 
    isInt=True
    End Function

    Function GetLen(str)
    Dim l, t, c, i
    l = Len(str)
    t = l
    For i = 1 To l
    c = Asc(Mid(str, i, 1))
    If c < 0 Then c = c + 65536
    If c > 255 Then t = t + 1
    Next
    GetLen = t
End Function

Function CheckStr(Str) 
    If Trim(Str)="" Or IsNull(str) Then Exit Function
    Checkstr=Replace(Trim(Str),"'","''")
End Function

Function LeftStr(text,length)  
    Dim t
    t=""
    Dim mt
    Dim l
    l=0
    Dim c
    For i= 1 To Len(text)
    mt=mid(text,i,1)
    c=Asc(mt)
    If c<0 Then c=c+65536
    If c > 255 Then
    l=l+2
    Else 
    l=l+1
    End If
    If l<=CLng(length) Then
    t=t&mt
    else
    exit for
    End If
    Next
    LeftStr=t
End Function

Rem Pw_Sys 日期格式转换函数
function DateTimeFormat(DateTime,Format) 
select case Format
case "1"
 DateTimeFormat=""&year(DateTime)&"年"&month(DateTime)&"月"&day(DateTime)&"日"
case "2"
 DateTimeFormat=""&month(DateTime)&"月"&day(DateTime)&"日"
case "3" 
 DateTimeFormat=""&year(DateTime)&"-"&month(DateTime)&"-"&day(DateTime)&""
case "4" 
 DateTimeFormat=""&year(DateTime)&"/"&month(DateTime)&"/"&day(DateTime)&""
case "5"
 DateTimeFormat=""&month(DateTime)&"/"&day(DateTime)&""
case "6"
 DateTimeFormat=""&year(DateTime)&"年"&month(DateTime)&"月"&day(DateTime)&"日<font color=red> "&FormatDateTime(DateTime,4)&"</font>"
case "7"
   temp="星期日,星期一,星期二,星期三,星期四,星期五,星期六"
   temp=split(temp,",") 
   DateTimeFormat=temp(Weekday(DateTime)-1)
case else
 DateTimeFormat=DateTime
end select
end function

Rem 判断数字是否整形
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
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -