?? function.asp
字號:
<%'***************************************************
'函數名:IsObjInstalled
'作 用:檢查組件是否已經安裝
'參 數:strClassString ----組件名
'返回值:True ----已經安裝
' False ----沒有安裝
'***************************************************
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function
'==================================================
'過程名:formatDTM
'作 用:格式化時間
'參 數:無
'==================================================
Function formatDTM(dtmStr,dtmFormat)
Dim yearStr:yearStr=Year(dtmStr)
Dim monthStr:monthStr=Month(dtmStr)
Dim dayStr:dayStr=Day(dtmStr)
Dim hourStr:hourStr=Hour(dtmStr)
Dim minuteStr:minuteStr=Minute(dtmStr)
Dim weekStr:weekStr=weekday(dtmStr)
Dim secondStr:secondStr=Second(dtmStr)
Dim longWeekday:longWeekday=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
Dim shortWeekday:shortWeekday=Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
Dim longMonth:longMonth=Array("January","February","March","April","May","June","July","August","September","October","November","December")
Dim shortMonth:shortMonth=Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
Dim AMPMStr
If hourStr>12 Then AMPMStr="PM" Else AMPMStr="AM"
If InStr(dtmFormat,"A")>0 Then hourStr=hourStr-12
Dim outDTM:outDTM=dtmFormat
Dim DayEnd
If InStr(outDTM,"th")>0 Then
select Case Right(dayStr,1)
Case 1
DayEnd="st"
Case 2
DayEnd="nd"
Case 3
DayEnd="rd"
Case Else
DayEnd="th"
End select
End If
outDTM=Replace(outDTM,"YYYY",yearStr)
outDTM=Replace(outDTM,"YY",Right(yearStr,2))
outDTM=Replace(outDTM,"MM",Right("00"&monthStr,2))
outDTM=Replace(outDTM,"M",monthStr)
outDTM=Replace(outDTM,"DD",Right("00"&dayStr,2))
outDTM=Replace(outDTM,"D",dayStr)
outDTM=Replace(outDTM,"HH",Right("00"&hourStr,2))
outDTM=Replace(outDTM,"H",hourStr)
outDTM=Replace(outDTM,"II",Right("00"&minuteStr,2))
outDTM=Replace(outDTM,"I",minuteStr)
outDTM=Replace(outDTM,"SS",Right("00"&secondStr,2))
outDTM=Replace(outDTM,"S",secondStr)
outDTM=Replace(outDTM,"A",AMPMStr)
outDTM=Replace(outDTM,"th",DayEnd)
outDTM=Replace(outDTM,"lw",longWeekday(weekStr-1))
outDTM=Replace(outDTM,"sw",shortWeekday(weekStr-1))
outDTM=Replace(outDTM,"lm",longMonth(monthStr-1))
outDTM=Replace(outDTM,"sm",shortMonth(monthStr-1))
formatDTM=outDTM
End Function
function int2chn(n)
dim i,j,k,strlen,retval,x,y,z,str
z=array("零","壹","貳","參","肆","伍","陸","柒","捌","玖")
y=array("","<b>十</b>","<b>佰</b>","<b>仟</b>")
x=Array(" ","<b>萬</b>","<b>億</b>","<b>萬 萬 億</b> ")
strlen=len(n)
str1=n
for i= 1 to strlen
j=mid(str1,i,1)
retval=retval&z(j)
if j>0 then retval=retval&y((strlen-i) mod 4)'如果大於零,加入十進位字符
retval=replace(retval,z(0)&z(0),z(0))'出現兩個零後只留一個
if ((strlen-i) mod 4)=0 and right(retval,1)=z(0) then retval=left(retval,len(retval)-1)'每四位加入進階
if ((strlen-i) mod 4)=0 then retval=retval&x(int((strlen-i)/4))'把最後的零去掉
next
int2chn=retval
end function
dim shopbh,lennum
function gen(shopbh,lennum)
do while Len(shopbh)<lennum
shopbh = 0& shopbh
loop
gen = shopbh
End function
sub WriteErrMsg()
dim strErr
strErr=strErr & "<html><head><title>錯誤信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbcrlf
strErr=strErr & "<link href='css.css' rel='stylesheet' type='text/css'></head><body>" & vbcrlf
strErr=strErr & "<table cellpadding=2 cellspacing=2 border=0 width=400 class='border' align=center>" & vbcrlf
strErr=strErr & " <tr align='center'><td height='20' class='title'><strong>錯誤信息</strong></td></tr>" & vbcrlf
strErr=strErr & " <tr><td height='100' class='tdbg' valign='top'><b>產生錯誤的可能原因:</b><br>" & errmsg &"</td></tr>" & vbcrlf
strErr=strErr & " <tr align='center'><td class='title'><a href='javascript:history.go(-1)'>【返回】</a></td></tr>" & vbcrlf
strErr=strErr & "</table>" & vbcrlf
strErr=strErr & "</body></html>" & vbcrlf
response.write strErr
end sub
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -