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

📄 inc_function.asp

📁 在线聊天系统
💻 ASP
字号:
<%


'######################################################
'显示日期
sub showdate()

	response.write "<input type='text' name='n' size='4' class=smallinput>"
	response.write "<b><font color='#003366'>年"
	response.write "<select name='y' class=smallselsect>"
		i=1
		do while i<13 
	response.write "<option>"&i&"</option>"
		i=i+1
		loop
	response.write "</select>"
	response.write "月"
	response.write "<select name='r' class=smallselsect>"
		i=1
		do while i<32
	response.write "<option>"&i&"</option>"
		i=i+1
		loop
	response.write "</select>"
	response.write "日</b></font>"
	
end sub
'############################################################

'##############################################################
'获取字符的ASC码
function getpychar(char)

tmp=65536+asc(char)
if(tmp>=45217 and tmp<=45252) then
getpychar= "A"
elseif(tmp>=45253 and tmp<=45760) then
 getpychar= "B"
elseif(tmp>=45761 and tmp<=46317) then 
getpychar= "C"
elseif(tmp>=46318 and tmp<=46825) then 
getpychar= "D"
elseif(tmp>=46826 and tmp<=47009) then 
getpychar= "E"
elseif(tmp>=47010 and tmp<=47296) then 
getpychar= "F"
elseif(tmp>=47297 and tmp<=47613) then 
getpychar= "G"
elseif(tmp>=47614 and tmp<=48118) then
 getpychar= "H"
elseif(tmp>=48119 and tmp<=49061) then 
getpychar= "J"
elseif(tmp>=49062 and tmp<=49323) then 
getpychar= "K"
elseif(tmp>=49324 and tmp<=49895) then
 getpychar= "L"
elseif(tmp>=49896 and tmp<=50370) then 
getpychar= "M"
elseif(tmp>=50371 and tmp<=50613) then 
getpychar= "N"
elseif(tmp>=50614 and tmp<=50621) then 
getpychar= "O"
elseif(tmp>=50622 and tmp<=50905) then 
getpychar= "P"
elseif(tmp>=50906 and tmp<=51386) then 
getpychar= "Q"
elseif(tmp>=51387 and tmp<=51445) then 
getpychar= "R"
elseif(tmp>=51446 and tmp<=52217) then 
getpychar= "S"
elseif(tmp>=52218 and tmp<=52697) then 
getpychar= "T"
elseif(tmp>=52698 and tmp<=52979) then 
getpychar= "W"
elseif(tmp>=52980 and tmp<=53688) then 
getpychar= "X"
elseif(tmp>=53689 and tmp<=54480) then 
getpychar= "Y"
elseif(tmp>=54481 and tmp<=62289) then 
getpychar= "Z"
else
getpychar=char
end if
end function
'#######################################################

'########################################################
'获取汉字首字母

function getpy(str)
for i=1 to len(str)
getpy=getpy&getpychar(mid(str,i,1))
next
end function
'#####################################################

'#####################################################
'性别选择
function getselect(sex)
if rs1("性别")=sex then 
getselect="selected"
end if
end function
'###################################################

'#####################################################
'获取当月的天数
Function GetDaysInMonth(iMonth, iYear)
	Select Case iMonth
		Case 1, 3, 5, 7, 8, 10, 12
			GetDaysInMonth = 31
		Case 4, 6, 9, 11
			GetDaysInMonth = 30
		Case 2
			If IsDate("February 29, " & iYear) Then
				GetDaysInMonth = 29
			Else 
				GetDaysInMonth = 28
			End If
	End Select
End Function
'######################################################

'#######################################################
'获取当月的第一天是星期几
Function GetWeekdayMonthStartsOn(iMonth, iYear)
	GetWeekdayMonthStartsOn = WeekDay(CDate(iMonth & "/1/" & iYear))
End Function
'#####################################################

'############################################
'获取前一个月的年月

Function SubtractOneMonth(dDate)
Dim iDay, iMonth, iYear	
	iDay = Day(dDate)
	iMonth = Month(dDate)
	iYear = Year(dDate)

	If iMonth = 1 Then
		iMonth = 12
		iYear = iYear - 1
	Else
		iMonth = iMonth - 1
	End If
	
	If iDay > GetDaysInMonth(iMonth, iYear) Then iDay = GetDaysInMonth(iMonth, iYear)

	SubtractOneMonth = CDate(iMonth & "-" & iDay & "-" & iYear)
End Function
'#########################################################3

'##########################################################
'获取后一个月的年月

Function AddOneMonth(dDate)
Dim iDay, iMonth, iYear	
	iDay = Day(dDate)
	iMonth = Month(dDate)
	iYear = Year(dDate)

	If iMonth = 12 Then
		iMonth = 1
		iYear = iYear + 1
	Else
		iMonth = iMonth + 1
	End If
	
	If iDay > GetDaysInMonth(iMonth, iYear) Then iDay = GetDaysInMonth(iMonth, iYear)

	AddOneMonth = CDate(iMonth & "-" & iDay & "-" & iYear)
End Function
'###########################################################

'#############################################################
'字符过滤(主要是回车,',<,>,空格,)
function char_filter(expression)
     expression=Replace(expression,chr(10),"\n",1,-1,1)
      expression=Replace(expression,"'","&prime;",1,-1,1)
      expression=Replace(expression,"<","&lt;",1,-1,1)
      expression=Replace(expression,">","&gt;",1,-1,1)
      expression=Replace(expression,chr(0)," ",1,-1,1)
     expression=Replace(expression,"\n","<br>",1,-1,1)

     char_filter=expression
end function
'################################################################

'##########################################################
'获取表单相同名字的字段,并付给数组
sub set_value(text,xx)
			on error resume next
			count=0
			for each item in Request.Form(text)
				xx(count)=item
				count=count+1
			next
			if Err.number <> 0 then
				response.Write "sub err:"& Err.Description 
			end if
end sub
'#############################################################

'#####################################################
'替换表单的单引号
function check_login(x)
x=replace(x,"'","''")
check_login=x
end function 
'#######################################################

'########################################################


sub showdate()

	response.write "<input type='text' onblur='return checkyear(this)' name='n' size='4' class=smallinput>"
	response.write "<b><font color='#003366'>年"
	response.write "<select name='y' class=smallselsect>"
		i=1
		do while i<13 
	response.write "<option value='"&i&"'>"&i&"</option>"
		i=i+1
		loop
	response.write "</select>"
	response.write "月"
	response.write "<select name='r' class=smallselsect>"
		i=1
		do while i<32
	response.write "<option value='"&i&"'>"&i&"</option>"
		i=i+1
		loop
	response.write "</select>"
	response.write "日</b></font>"
	
end sub

'##############################################

'################################################3
'过滤字段中间的所有空格
function filt_space(str)
dim t,z
t=trim(str)
dim count
count=len(t)
for i=1 to count
	z=z+Mid(t,i,1)
	z=trim(z)
    
next
filt_space=z
end function
'******************************************
'根据文件路径
'获取文件名  
'方法:找到最后一个'\' 
function getFileName( byVal thePath )
     getFileName = RIGHT( thePath, len( thePath ) - instrREV( thePath, "/" ) )
end function 
'************************************************
%>

⌨️ 快捷键说明

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