日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

談asp非常實(shí)用的代碼(3)_ASP教程

編輯Tag賺U幣
教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!

推薦:如何提高asp程序訪問(wèn)速度
用asp程序進(jìn)行網(wǎng)頁(yè)設(shè)計(jì),大多因?yàn)樾枰L問(wèn)數(shù)據(jù)庫(kù),然后再將數(shù)據(jù)顯示到頁(yè)面,如果數(shù)據(jù)很多的話,頁(yè)面的訪問(wèn)速度也就變慢了,為了解決這個(gè)問(wèn)題,可以用以下技巧來(lái)提高頁(yè)面訪問(wèn)速度。 技巧之一:提高使用Request集合的效率 訪問(wèn)一個(gè)ASP集合來(lái)提取一個(gè)值是費(fèi)時(shí)的

 格式化日期時(shí)間(顯示) 
’ 參數(shù):n_Flag 
’ 1:"yyyy-mm-dd hh:mm:ss" 
’ 2:"yyyy-mm-dd" 
’ 3:"hh:mm:ss" 
’ 4:"yyyy年mm月dd日" 
’ 5:"yyyymmdd" 
’ 6:"yyyymmddhhmmss" 
’ 7:"yy-mm-dd"  
’ 8:"yy-mm-dd hh:mm:ss" 
’ 9:"yyyy年mm月" 
’ 10:"mm/dd/yyyy" 
’ ============================================ 
Function Format_Time(s_Time, n_Flag) 
Dim y, m, d, h, mi, s 
Format_Time = "" 
If IsDate(s_Time) = False Then Exit Function 
y = cstr(year(s_Time)) 
if y = "1900" then Exit Function 
m = right("0"&month(s_Time),2) 
d = right("0"&day(s_Time),2) 
h = right("0"&hour(s_Time),2) 
mi = right("0"&minute(s_Time),2) 
s = right("0"&second(s_Time),2) 

Select Case n_Flag 
Case 1 
Format_Time = y & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s 
Case 2 
Format_Time = y & "-" & m & "-" & d 
Case 3 
Format_Time = h & ":" & mi & ":" & s 
Case 4 
Format_Time = y & "年" & m & "月" & d & "日" 
Case 5 
Format_Time = y & m & d 
case 6 
Format_Time= y & m & d & h & mi & s 
case 7 
Format_Time= right(y,2) & "-" & m & "-" & d 
case 8 
Format_Time= right(y,2) & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s 
Case 9 
Format_Time = y & "年" & m & "月" 
Case 10 
Format_Time = m & "/" & d & "/" & y & "/" 
End Select 
End Function 


小寫數(shù)字轉(zhuǎn)大寫 

function int2chn(n) 
dim i,j,k,strlen,retval,x,y,z,str 
z=array("零","壹","貳","叁","肆","伍","陸","柒","捌","玖") 
y=array("","拾","佰","仟") 
x=Array("","萬(wàn)","億","萬(wàn)萬(wàn)億") 
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)’如果大于零,加入十進(jìn)位字符 
retval=replace(retval,z(0)&z(0),z(0))’出現(xiàn)兩個(gè)零只留一個(gè) 
if ((strlen-i) mod 4)=0 and right(retval,1)=z(0) then retval=left(retval,len(retval)-1)’每四位加入進(jìn)階 
if ((strlen-i) mod 4)=0 then retval=retval&x(int((strlen-i)/4))’把最后的零去掉 
next 
int2chn=retval 
end function 

小寫金額轉(zhuǎn)大寫 

Function UMoney(money) 
Dim lnP,Prc,Tmp,NoB,Dx,Xx,Zhen 
Dim China : China = "分角元拾佰仟萬(wàn)拾佰仟億" 
Dim str: str = Array("零", "壹", "貳", "叁", "肆", "伍", "陸", "柒", "捌", "玖")    
Zhen = True    
money = FormatNumber(money, 2)    
Prc = CStr(money)    
Prc = Replace(Prc, ",", "")        
lnP = Len(Prc)    
For i = lnP - 1 To 1 Step -1        
If Mid(Prc, i, 1) = "." Then            
Select Case lnP - i                
Case 1                    
Prc = Replace(Prc, ".", "") + "0"                
Case 2                    
Prc = Replace(Prc, ".", "")            
End Select            
Zhen = False            
Exit For        
End If    
Next    
If Zhen Then Prc = Prc + "00"    
lnP = Len(Prc)    
For i = 1 To lnP        
Tmp = str(Mid(Prc, i, 1)) & Tmp    
Next    
UMoney = ""    
fy = 1    
For i = 1 To lnP        
Xx = Mid(Tmp, i, 1)        
Dx = Mid(China, i, 1)                
If Xx <> "零" Then            
UMoney = Xx & Dx & UMoney            
f = 1        
Else            
If i = 3 Then            
UMoney = Dx & UMoney            
End If                    
If i = 7 Then                
UMoney = Dx & UMoney            
End If            
If f Then                
UMoney = "零" & UMoney            
End If            
f = 0        
End If    
Next    
If Zhen Then UMoney = UMoney + "整"    
UMoney = Replace(UMoney, "零萬(wàn)", "萬(wàn)")    
UMoney = Replace(UMoney, "零元", "元") 
End Function 


隨機(jī)選取5組彩票

Function rndtest(m_count,r_count) ’’參數(shù)m_count號(hào)碼總數(shù),r_count為要取出的號(hào)碼數(shù)
dim x,st,i
i=1
st=""
do while i<=r_count
randomize
x=int(rnd*m_count)+1 ’’產(chǎn)生1~m_count的隨機(jī)數(shù)
if i=r_count then
if not instr(st,x)>0 then
st=st&x 
i=i+1
end if
else
if not instr(st,x)>0 then
st=st&x&","  ’’用,分割
i=i+1
end if
end if
if i>=m_count then
 exit do ’’如果m_count小于r_count將出現(xiàn)死循環(huán),于是判斷并跳出循環(huán)
end if
loop
rndtest=st
end function

冒泡函數(shù)

function sort(ary)ck=true
do Until ck = false 
 ck=false
 For f = 0 to UBound(ary) -1
  if clng(ary(f))>clng(ary(f+1)) then
   v1=clng(ary(f))
   v2=clng(ary(f+1))
   ary(f)=v2
   ary(f+1)=v1
   ck=true
  end if
 next
loop
sort=ary
end function

for i=0 to 4
Mycount=rndtest(33,7)
MyArray=split(Mycount,",")
newArray=sort(MyArray)
for i2=0 to UBound(newArray)
Response.Write(newArray(i2)&" ")
next
Response.Write("<br>")
next
 

分享:詳解ASP的Session對(duì)象
一、屬性 1、SessionID SessionID屬性返回用戶的會(huì)話標(biāo)識(shí)。在創(chuàng)建會(huì)話時(shí),服務(wù)器會(huì)為每一個(gè)會(huì)話生成一個(gè)單獨(dú)的標(biāo)識(shí)。會(huì)話標(biāo)識(shí)以長(zhǎng)整形數(shù)據(jù)類型返回。在很多情況下SessionID可以用于WEB頁(yè)面注冊(cè)統(tǒng)計(jì)。 2、TimeOut Timeout屬性以分鐘為單位為該應(yīng)用程序的Sessi

來(lái)源:模板無(wú)憂//所屬分類:ASP教程/更新時(shí)間:2010-01-31
相關(guān)ASP教程