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

📄 function.asp

📁 Simple涂乌板2
💻 ASP
字号:
<%
'图像地址译码
Function ImageSrc(image)
		ImageSrc="images/image/SymphonicRain/sphonie_"&image&".gif"
End Function

'编译换行和空格符
Function Htmlencode2(FString)
FString=replace(FString,"<","&lt;")
FString=replace(FString,">","&gt;")
FString=replace(FString,"'","'")
FString=replace(FString,vbCrLf,"<br>")
FString=replace(FString," ","&nbsp;")
Htmlencode2=FString
End Function

'字符长度(中文2,字母1)
Function GetStrLen(str)
    If IsNull(str) Or str = "" Then
        getStrLen = 0
    Else
        Dim i, n, k, chrA
        k = 0
        n = Len(str)
        For i = 1 To n
            chrA = Mid(str, i, 1)
            If Asc(chrA) >= 0 And Asc(chrA) <= 255 Then
                k = k + 1
            Else
                k = k + 2
            End If
        Next
        getStrLen = k
    End If
End Function

'先格式化HTML代码
Function Replacehtml(Textstr)
	Dim Str,re
	Str = Textstr
	Set re = new RegExp
	re.IgnoreCase =True
	re.Global = True
	re.Pattern = "<(.[^>]*)>"
	Str = re.Replace(Str, "")
	Set Re = Nothing
	Replacehtml = Str
End Function

'判断登录Session是否已经建立
If Session("visitor")=Empty Then
	Response.Redirect "index.asp"
End If

'分页模块
Function ASPMOD(n1,n2)
	If n1>n2 Then
	n3=int(n1/n2)
	ASPMOD=n1-(n3*n2)
	Else ASPMOD=n1
	End If
End Function

Function DividePage(PageSize,RecordCount)
	Dim n3,n1,n2
	
	PageNo=Int(Request("PageNo"))
	If PageNo=0 Or PageNo="" then
	PageNo=1
	End If
	
	n1=RecordCount
	n2=PageSize
	
	If n1<=n2 Then        '[到页末]记录比每页数少,不能分页
		n_array_max=n1-1
		PageCount=1
	Else		'[到页末]记录比每页数多,可以分页
		If ASPMOD(n1,n2)=0 Then       '整除
		PageCount=int(n1/n2)
		Else      '不整除
		PageCount=int(n1/n2)+1
		End If
		
		If PageNo=PageCount Then		'[到页末]
		n_array_max=ASPMOD(n1,n2)-1
			If ASPMOD(n1,n2)=0 Then       '整除
			n_array_max=n2-1
			End If
		Else		'[未到页末]
		n_array_max=n2-1
		End If
	End If
	n_array_start=(PageNo-1)*n2

	DividePage=Array(n_array_start,n_array_max+n_array_start,PageCount,PageNo)
	'DividePage(PageSize,RecordCount)(0)返回该页的第一条记录
	'DividePage(PageSize,RecordCount)(1)返回该页的最后一条记录
	'DividePage(PageSize,RecordCount)(2)返回页的总数
	'DividePage(PageSize,RecordCount)(3)返回所在的页数
End Function
%>

<%
'模式查看
'mode=0 --一般留言
'mode=1  --主题列表
'mode=2  --阅读主题
'mode=3  --发表新主题
'mode=4  --回复留言
'mode=5  --引用留言
'mode=6  --回复主题
'mode=7  --只查看留言
'mode=8  --只查看主题表
%>

⌨️ 快捷键说明

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