?? inc_function.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,"'","′",1,-1,1)
expression=Replace(expression,"<","<",1,-1,1)
expression=Replace(expression,">",">",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 + -