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

📄 function1.asp

📁 20041230162250801409: 浙江省丽水市公铁联运有限公司OA系统(物流) 开发语言:PHP/ASP/PERL 本系统包括各个部门的管理
💻 ASP
字号:
<%
'作  用:删除无用图片
'参  数:strUploadFiles ------ 图片路径
sub DelFiles(strUploadFiles)
	if strUploadFiles="" then exit sub
		dim fso,arrUploadFiles
		Set fso = CreateObject("Scripting.FileSystemObject")
			if fso.FileExists(server.MapPath(strUploadfiles)) then
				fso.DeleteFile(server.MapPath(strUploadfiles))
			end if
end sub
'截字符串,汉字一个算两个字符,英文算一个字符
'参  数:str   ----原字符串
'       strlen ----截取长度
function gotTopic(str,strlen)
	if isnull(str) then
		gotTopic=""
		exit function
	end if
	dim l,t,c, i
	str=replace(replace(replace(replace(str,"&nbsp;"," "),"&quot;",chr(34)),"&gt;",">"),"&lt;","<")
	l=len(str)
	t=0
	for i=1 to l
		c=Abs(Asc(Mid(str,i,1)))
		if c>255 then
			t=t+2
		else
			t=t+1
		end if
		if t>=strlen then
			gotTopic=left(str,i) & "…"
			exit for
		else
			gotTopic=str
		end if
	next
	gotTopic=replace(replace(replace(replace(gotTopic," ","&nbsp;"),chr(34),"&quot;"),">","&gt;"),"<","&lt;")
end function
'显示错误信息
function errorMsg(mes)
%>
<script language="vbscript">
	alert "<%=mes%>"
	history.back(-1)
</script>
<%
response.end
end function
'显示找不到产品的错误信息
function found(mes)
Response.Write mes
end function
'检查是否为整数
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
'判断邮件是否合法
function IsValidEmail(email)
dim names, name, i, c
IsValidEmail = true
names = Split(email, "@")
if UBound(names) <> 1 then 
   IsValidEmail = false
   exit function
end if
for each name in names 
   if Len(name) <= 0 then
     IsValidEmail = false
     exit function
   end if
   for i = 1 to Len(name)
     c = Lcase(Mid(name, i, 1))
     if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
       IsValidEmail = false
       exit function
     end if
   next
   if Left(name, 1) = "." or Right(name, 1) = "." then 
      IsValidEmail = false
      exit function
   end if
next
if InStr(names(1), ".") <= 0 then
   IsValidEmail = false
   exit function
end if
i = Len(names(1)) - InStrRev(names(1), ".")
if i <> 2 and i <> 3 then
   IsValidEmail = false
   exit function
end if
if InStr(email, "..") > 0 then
   IsValidEmail = false
end if

end function
'检测表单的准确性
Sub IsTrue(Num,Str,IsNum)
if T(Num)<>"" then
   Select Case IsNum
      Case "IsNum"
		  if isnumeric(T(Num))=False then errorMsg(Str)
	  Case "IsSix"
	      If Len(T(Num))<>6 or isnumeric(T(Num))=False then errorMsg(Str)
	  Case "IsDate"
	  	  If IsDate(T(Num))=False then errorMsg(Str)
      Case "IsShen"
	  	  If isnumeric(Mid(T(Num),1,13))=False or (Len(T(Num))<>15 and Len(T(Num))<>18) then errorMsg(Str)
      Case "IsMail"
	      If IsValidEmail(T(Num))=False then errorMsg(Str)
   End Select
end if
end Sub
'过滤字符
function ReplaceBadChar(strChar)
	if strChar="" then
		ReplaceBadChar=""
	else
		ReplaceBadChar=replace(strChar,"'","")
	end if
end function
Function HtmlEncode(str)
   If Trim(Str)="" Or IsNull(str) Then Exit Function
   str=Replace(str,">","&gt;")
   str=Replace(str,"<","&lt;")
   str=Replace(str,Chr(32),"&nbsp;")
   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,Chr(10) & Chr(10), "</p><p>")
   str=Replace(str,Chr(10),"<br> ")
   HtmlEncode=str
End Function
Function HtmlEncodefan(str)
   If Trim(Str)="" Or IsNull(str) Then Exit Function
   str=Replace(str,"&gt;",">")
   str=Replace(str,"&lt;","<")
   str=Replace(str,"&nbsp;",Chr(32))
   str=Replace(str,"&nbsp;",Chr(9))
   str=Replace(str,"&quot;",Chr(34))
   str=Replace(str,"&#39;",Chr(39))
   str=Replace(str,"",Chr(13))
   str=Replace(str,"</p><p>", Chr(10) & Chr(10))
   str=Replace(str,"<br> ",Chr(10))
   HtmlEncodefan=str
End Function

'分页
Sub BoardChangePage(msg,Page,TotalReCount,PageSize,Url,KeyWord)
Dim TotalPage,StartPage,EndPage,i
TotalPage = ALLPage
With Response
   .Write " 共[<font color=red>"& ALLCount &"</font>]"& msg &" 每页[<font color=red>"& PageSize &"</font>]个 共[<font color=red>"& ALLPage &"</font>]页" 
   If Page > 1 Then
   .Write " <a href="& Url &"Page=1&C="& TotalReCount &"&KeyWord="& KeyWord &"><font size=2 face=webdings>7</font></a>"
   .Write " <a href="& Url &"Page="& Page-1 &"&C="& TotalReCount &"&KeyWord="& KeyWord &"><font size=2 face=webdings>3</font></a>"
End If

If TotalPage > 5 Then
    If Page < TotalPage - 4 And TotalPage > 10 Then
        EndPage = Page + 5
        If Page < 5 Then EndPage = 10
    Else
        EndPage = TotalPage
    End If
Else
    EndPage = TotalPage
End If

If Page > 10 Then
    StartPage = Page - 5
Else
    StartPage = 1
    If TotalPage >= 10 Then EndPage = 10
End If

For i = StartPage to EndPage 
   If i <> Page Then
      If i > Page Then 
      .Write "&nbsp;[<a href="& Url &"Page="& i &"&C="& TotalReCount &"&KeyWord="& KeyWord &">"& i &"</a>]"
      Else
      .Write "&nbsp;[<a href="& Url &"Page="& i &"&C="& TotalReCount &"&KeyWord="& KeyWord &">"& i &"</a>]"
      End If
   Else
      .Write "&nbsp;[<font color=#990000>"& i &"</font>]"
   End If
Next
End With
If Page < TotalPage Then Response.write("<a href=" & Url & "Page="& Page + 1 & "&C=" & TotalReCount & "&KeyWord="& KeyWord &"><font size=2 face=webdings>4</font></a> <a href=" & Url & "Page=" & ALLPage & "&C=" & TotalReCount & "&KeyWord="& KeyWord &"><font size=2 face=webdings>8</font></a>")

End Sub
'查找记录的SQL
Function GetBoardList(Filed,FormName,Soft,Page,TotalRec,PageSize,Flag,My)
Dim SQL,Rs
If My="1" then
   If Page > 1 Then
       End_Id = (Page - 1) * PageSize
       sql = "Select top "& PageSize &" "& Filed &" From ["& FormName &"] where "& Flag &" And "& Soft &"<(Select Min("& Soft &") as T_ID From (Select top "& End_Id &" "& Soft &" From ["& FormName &"] where "& Flag &" Order By "& Soft &" Desc) as temp_Log1 ) Order By "& Soft &" Desc "
   Else
       sql = "Select top "& PageSize &" "& Filed &" From ["& FormName &"] Where "& Flag &" Order By "& Soft &" Desc "
   End If
Else
   If Page > 1 Then
       End_Id = (Page - 1) * PageSize
       sql = "Select top "& PageSize &" "& Filed &" From ["& FormName &"] where "& Soft &"<(Select Min("& Soft &") as T_ID From (Select top "& End_Id &" "& Soft &" From ["& FormName &"] Order By "& Soft &" Desc) as temp_Log1 ) Order By "& Soft &" Desc "
   Else
       sql = "Select top "& PageSize &" "& Filed &" From ["& FormName &"] Order By "& Soft &" Desc "
   End If
End if
    set rs = conn.execute(sql)
    If Rs.EOF Then
    GetBoardList = False
    Exit Function
    End If
    GetBoardList = Rs.getrows(PageSize)
    Rs.Close
    Set Rs = Nothing
End Function
function CountNum(soft,str,tiaojie,flag)
If flag="1" then
sql="select count("& soft &") as aa from "&str&" where "&tiaojie
Else
sql="select count("& soft &") as aa from "&str
End if
set rs=conn.execute(sql)
Response.Write rs("aa")
rs.close
set rs=nothing
end function
%>
<SCRIPT language=JavaScript>
function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
var isopen=0;
function viewreply(e,c,url) {
e.style.display=(e.style.display=="none")?"":"none";
if(isopen==0){c.location.href=url;}
isopen=1;
}
</SCRIPT>

⌨️ 快捷键说明

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