欧美亚洲国产精品久久蜜芽,国产精品视频观看裸模,精品福利视频网,亚洲 欧美 偷自乱 图片 ,国产精品99久久久,国产男女XX00免费观看,任我操在线视频,在线观看无码a∨

ASP常用函數收藏

2012/7/22 16:32:191084 閱讀

    幾年前收集,沒有測試,使用者自己驗證
    1.函數array()
    功能:創建一個數組變量
    格式:array(list)
    參數:list 為數組變量中的每個數值列,中間用逗號間隔
    例子:

    <% i = array (“1”,”2”,”3”) %> 
    

    結果: i 被賦予為數組

    2.函數Cint()
    功能:將一表達式/其它類型的變量轉換成整數類型(int)
    格式:Cint(expression)
    參數:expression 是任何有效的表達式/其它類型的變量
    例子:

    <% f = ”234” response.write cINT(f) + 2 %> 
    

    結果: 236

    函數Cint()將字符”234”轉換 成整數234.如果表達式為空, 或者無效時,返回值為0;
    3.函數:Creatobject()
    功能:創建及返回一個ActiveX對象.
    格式:Creatobject(obname)
    參數bname 是對象的名稱
    例子:

    <% Set con = Server.CreateObject(“ADODB.Connection”) %> 
    

    結果:

    4.函數Cstr()
    功能:將一表達式/其它類型的變量轉換成字符類型(string)
    格式:Cstr(expression)
    參數:expression是任何有效的表達式/其它類型的變量
    例子:

    <% s = 3 + 2 response.write ”The result is: ”& cStr(s) %> 
    

    結果:函數Cstr()將整數 5 轉換 成字符”5”.

    5.函數Date()
    功能:返回當前系統(server端)的日期
    格式: Date()
    參數:無
    例子

    <% date () %> 
    

    結果:05/10/00
    6.函數Dateadd()
    功能:計算某個指定的時間和
    格式: dateadd(timeinterval,number,date)
    參數:timeinterval是時間單位(月,日..); number是時間間隔值,date是時間始點.
    例子:

    <% currentDate = #8/4/99# newDate = DateAdd(“m”,3,currentDate) response.write newDate %> 
    <% currentDate = #12:34:45 PM# newDate = DateAdd(“h”,3,currentDate) response.write newDate %> 
    

    結果:

    11/4/99
    3:34:45 PM
    其中
    “m” = ”month”;
    “d” = ”day”;
    如果是currentDate 格式,則,
    “h” = ”hour”;
    “s” = ”second”;
    7.函數Datediff()
    功能:計算某量個指定的時間差
    格式: datediff(timeinterval,date1,date2[,firstdayofweek[,firstdayofyear]])
    參數: timeinterval 是時間單位; date1,date2是有效的日期表達式,firstdayofweek,firstdayofyear 是任意選項.
    例子:
    fromDate = #8/4/99#
    toDate = #1/1/2000#
    response.write ”There are ”& _
    DateDiff(“d”,fromDate,toDate)& _
    "days to millenium from 8/4/99."
    結果:There are 150 days to millenium from 8/4/99.
    8.函數day()
    功能:返回一個整數值,對應于某月的某日
    格式: day(date)
    參數: date是一個有效的日期表達式;

    例子

    <% =date(#8/4/99#) %>

    結果:4

    9.函數formatcurrency()
    功能:轉換成貨幣格式
    格式: formatcurrency(expression [,digit[,leadingdigit[,paren[,groupdigit]]]])
    參數: expression 是有效的數字表達式;digit表示小數點后的位數;leadingdigit,paren,groupdigit是任意選項.
    例子<%=FormatCurrency(34.3456)%>
    結果34.35
    10.函數Formatdatetime()
    功能:格式化日期表達式/變量
    格式: formatdatetime(date[,nameformat])
    參數: date為有效的日期表達式/變量;nameformat是指定的日期格式常量名稱.
    例子formatdatetime(“08/04/99”,vblongdate) 
    結果:Wednesday,August 04,1999
    說明:
    描述:返回表達式,此表達式已被格式化為日期或時間。
    語法
    FormatDateTime(Date[, NamedFormat])
    FormatDateTime 函數的語法有以下參數:
    參數 描述
    Date 必選項。要被格式化的日期表達式。
    NamedFormat 可選項。指示所使用的日期/時間格式的數值,如果省略,則使用 vbGeneralDate。
    設置
    NamedFormat 參數可以有以下值:
    常數 值 描述
    vbGeneralDate 0 顯示日期和/或時間。如果有日期部分,則將該部分顯示為短日期格式。如果有時間部分,則將該部分顯示為長時間格式。如果都存在,則顯示所有部分。
    vbLongDate 1 使用計算機區域設置中指定的長日期格式顯示日期。
    vbShortDate 2 使用計算機區域設置中指定的短日期格式顯示日期。
    vbLongTime 3 使用計算機區域設置中指定的時間格式顯示時間。
    vbShortTime 4 使用 24 小時格式 (hh:mm) 顯示時間。
    說明
    下面例子利用 FormatDateTime 函數把表達式格式化為長日期型并且把它賦給 MyDateTime:
    Function GetCurrentDate
    'FormatDateTime 把日期型格式化為長日期型。
    GetCurrentDate = FormatDateTime(Date, 1)
    End Function
    11.函數Isnumeric()
    功能:返回一個布爾值,判斷變量是否為數字變量,或者是可以轉換成數字的其它變量.
    格式:isnumeric(expression)
    參數:expression 是任意的變量.
    例子:
    i="234"
    response.write isnumeric(i)

    結果: true.

    12.函數Isobject()
    功能:返回一個布爾值,判斷變量是否為對象的變量,
    格式: isobject(expression)
    參數: expression 是任意的變量.
    例子:
    set con =server.creatobject(“adodb.connection”)
    response.write isobject(con)

    結果: true

    13.函數:Lbound()
    功能:返回一個數組的下界.
    格式:Lbound(arrayname[,dimension])
    參數:arrayname 是數組變量,dimension 是任意項
    例子:
    i = array(“1”,”2”,”3”)
    response.write lbound(i)

    結果:0

    14.函數Lcase()
    功能:將一字符類型變量的字符全部變換小寫字符.
    格式:Lcase(string)
    參數:string是字符串變量
    例子:
    str=“THIS is Lcase!”
    response.write Lcase(str)

    結果:this is lcase!

    15.函數left()
    功能:截取一個字符串的前部分;
    格式:left(string,length)
    參數:string字符串,length截取的長度.

    例子:

    left("this is a test!",6) 

    結果:this i

    16.函數len()
    功能:返回字符串長度或者變量的字節長度
    格式:len(string *varname)
    參數:string字符串;varname任意的變量名稱
    例子:
    strtest="this is a test!"
    response.write left(strtest)
    結果:15
    17.函數ltrim()
    功能:去掉字符串前的空格.
    格式:ltrim(string)
    參數:string 字符串.

    例子: 


    ltrim ("this is a test!")

    結果:this is a test!

    18.函數Mid()
    功能:從字符串中截取字符串.
    格式:mid(string,start [,length])
    參數:string字符串,start截取的起點,length要截取的長度.
    例子:
    strtest=“this is a test, Today is Monday!”
    response.write mid(strtest,17,5)

    結果:Today

    19.函數minute()
    功能:返回一數值, 表示分鐘
    格式:minute(time)
    參數: time是時間變量

    例子

    =minute(#12:23:34#)

    結果:23

    20.函數month()
    功能:返回一數值, 表示月份
    格式:month(time)
    參數:time是日期變量

    例子

    =month(#08/09/99) 

    結果:9

    21.函數monthname()
    功能:返回月份的字符串(名稱).
    格式:Monthname(date [,abb])
    參數: date是日期變量,abb=true時 則月份的縮寫,
    例子:


    monthname(#4/5/99#)


    結果:April
    22.函數Now()
    功能:返回系統的當前時間和日期.
    格式:now()
    參數:無
    例子:
    =now() 

    結果: 05/10/00 8:45:32 pm

    23.函數:replace()
    功能:在字符串中查找,替代指定的字符串.
    格式:replace(strtobesearched,strsearchfor,strreplacewith [,start[,count[,compare]]])
    參數:strtobesearched是字符串; strsearchfor是被查找的子字符串;strreplacewith 是用來替代的子字符串.start,count,compare 是任意選項.
    例子:
    strtest=“this is an apple.”
    response.write replace(strtest,”apple”,”orange”)

    24.函數right()

    功能:截取一個字符串的后部分
    格式:right(string,length)
    參數:string字符串,length截取的長度.
    例子:
    strtest=“this is a test!”
    response.write right(strtest,3)

    結果:st!

    25.函數rnd()
    功能:返回一個隨機數值
    格式:rnd[(number)]
    參數:number是任意數值.
    例子:
    randomize()
    response.write rnd()

    結果:0/1數值之一,無randomize(), 則不能產生隨機數.

    26.函數round()
    功能:完整數值
    格式:round(expression[,numright])
    參數:expression數字表達式;numright任意選項.
    例子:
    i=12.33654
    response.write round(i)

    結果: 12

    27.函數rtrim()
    功能:去掉字符串后的空格.
    格式:rtrim(string)
    參數:string 是字符串
    例子:
    response.write rtrim(“this is a test! ”)
    結果:this is a test!
    28.函數second()
    功能:返回一個整數值.
    格式:second(time)
    參數:time是一個有效的時間表達式;
    例子lt;% =second(# 12:28:30#) %>
    結果:30
    29.函數strReverse()
    功能:返回與原字符串排列逆向的字符串.
    格式:strreverse(string)
    參數:string是字符串
    例子<% =strreverse(“this is a test!”)
    結果:!tset a si siht
    30.函數time()
    功能:返回當前系統的時間值.
    格式:time()
    參數:無
    結果:9:58:28 Am
    31.函數trim()
    功能:刪去字符串前,后的空格.
    格式:trim(string)
    參數:string 字符串.
    例子:
     
    strtest="this is a test!"
    response.write trim(strtest)
    結果:this is a test!
    32.函數UBound()
    功能:返回一個數組的上界.
    格式:Ubound(expression [,dimension])
    參數:expression 是數組表達式/數組變量,dimension 是任意項
    例子:
    i = array(“1”,”2”,”3”)
    response.write ubound(i)
    結果: 2
    33.函數:UCase()
    功能:將一字符類型變量的字符全部變換成大寫字符.
    格式:Ucase(string)
    參數:string是字符串變量
    例子:
    <%
    str=“THIS is Lcase!”
    response.write Lcase(str)
    %>
    結果:THIS IS LCASE!
    34.函數Vartype()
    功能:返回變量的常量代碼(整數)
    格式:Vartype(varname)
    參數:varname是任何類型的變量名稱.
    例子:
    <%
    i=5
    response.write vartype(i)
    %>
    結果:2 (2表示整數,須要參考ASP常量代碼.)
    35.函數Weekday()
    功能:返回一個整數,對應一周中的第幾天.
    格式:Weekday(date [,firstofweek])
    參數: date為日期變量,firstofweek為任選項.
    例子:
    <%
    d= # 5/9/00 #
    response.write weekday(d) %>
    結果:3(3 表示是星期二)
    36.函數weekdayname()
    功能:返回字符串,對應星期幾.
    格式:weekdayname(weekday[,abb[,firstdayofweek]])
    參數:weekday為日期變量,abb,firstdayofweek為任選項.
    例子:
    <%
    d = #8/4/99#
    response.write weekdayname(d)
    %>
    結果: Wednesday
    37.函數year()
    功能:返回日期表達式所在的年份.
    格式:year(date)
    參數: date是有效的日期表達式
    例子:
    <% =year(#8/9/99#) %>
    結果:1999
    38.函數Mod()功能:取余數.
    例子:3 Mod 2
    結果:1
    常用函數:
    *******************************************************************
    '取得IP地址
    '*******************************************************************
    Function Userip()
    Dim GetClientIP
    '如果客戶端用了代理服務器,則應該用ServerVariables("HTTP_X_FORWARDED_FOR")方法
    GetClientIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
    If GetClientIP = "" or isnull(GetClientIP) or isempty(GetClientIP)
    Then
    '如果客戶端沒用代理,應該用Request.ServerVariables("REMOTE_ADDR")方法
    GetClientIP = Request.ServerVariables("REMOTE_ADDR")
    end if
    Userip = GetClientIP
    End function


    '*******************************************************************
    '轉換IP地址
    '*******************************************************************
    function cip(sip)
    tip=cstr(sip)
    sip1=left(tip,cint(instr(tip,".")-1))
    tip=mid(tip,cint(instr(tip,".")+1))
    sip2=left(tip,cint(instr(tip,".")-1))
    tip=mid(tip,cint(instr(tip,".")+1))
    sip3=left(tip,cint(instr(tip,".")-1))
    sip4=mid(tip,cint(instr(tip,".")+1))
    cip=cint(sip1)*256*256*256+cint(sip2)*256*256+cint(sip3)*256+cint(sip4)
    end function
    '*******************************************************************
    ' 彈出對話框
    '*******************************************************************
    Sub alert(message)
    message = replace(message,"'","\'")
    Response.Write ("alert('"& message& "')")
    End Sub

    '*******************************************************************
    ' 返回上一頁,一般用在判斷信息提交是否完全之后
    '*******************************************************************
    Sub GoBack()
    Response.write ("history.go(-1)")
    End Sub
    '*******************************************************************
    ' 重定向另外的連接
    '*******************************************************************
    Sub Go(url)
    Response.write ("location.href('"& url& "')")
    End Sub
    '*******************************************************************
    ' 指定秒數重定向另外的連接
    '*******************************************************************
    sub GoPage(url,s)
    s=s*1000
    Response.Write ""
    Response.Write
    "window.setTimeout("&chr(34)&"window.navigate('"&url&"')"&chr(34)&","&s&")"
    Response.Write ""
    end sub
    '*******************************************************************
    ' 判斷數字是否整形
    '*******************************************************************
    function isInteger(para)
    on error resume next
    dim str
    dim l,i
    if isNUll(para) then
    isInteger=false
    exit function
    end if
    str=cstr(para)
    if trim(str)="" then
    isInteger=false
    exit function
    end if
    l=len(str)
    for i=1 to l
    if mid(str,i,1)>"9" or mid(str,i,1)<"0" then 
    isInteger=false 
    exit function 
    end if 
    next isInteger=true 
    if err.number<>0 then 
    err.clear
    end function
    
    '*******************************************************************
    ' 獲得文件擴展名
    '*******************************************************************
    function GetExtend(filename)
    dim tmp
    if filename<>"" then
    tmp=mid(filename,instrrev(filename,".")+1,len(filename)-instrrev(filename,"."))
    tmp=LCase(tmp)
    if instr(1,tmp,"asp")>0 or instr(1,tmp,"php")>0 or instr(1,tmp,"php3")>0
    or instr(1,tmp,"aspx")>0 then
    getextend="txt"
    else
    getextend=tmp
    end if
    else
    getextend=""
    end if
    end function
    *  ' * 函數:CheckIn ' * 描述:檢測參數是否有SQL危險字符 ' * 參數:str要檢測的數據 ' * 返回:FALSE:安全 TRUE:不安全 ' * 作者: ' * 日期: ' * 
    function CheckIn(str)
    if instr(1,str,chr(39))>0 or instr(1,str,chr(34))>0 or
    instr(1,str,chr(59))>0 then
    CheckIn=true
    else
    CheckIn=false
    end if
    end function
    
    
    *--- - ' * 函數:HTMLEncode ' * 描述:過濾HTML代碼 ' * 參數:-- ' * 返回:-- ' * 作者: ' * 日期: ' * 
    function HTMLEncode(fString)
    if not isnull(fString) then
    fString = replace(fString, ">", ">")
    fString = replace(fString, "<", "<") 
    fString = Replace(fString, CHR(32), " ") 
    fString = Replace(fString, CHR(9), " ") 
    fString = Replace(fString, CHR(34), """) 
    fString = Replace(fString, CHR(39), "'") 
    fString = Replace(fString, CHR(13), "") 
    fString = Replace(fString, CHR(10)&CHR(10), " ") 
    fString = Replace(fString, CHR(10), "") 
    HTMLEncode = fString 
    end if 
    end function 
    
    ' *-- -- ' * 函數:HTMLcode ' * 描述:過濾表單字符 ' * 參數:-- ' * 返回:-- ' * 作者: ' * 日期: ' *--- 
    function HTMLcode(fString) 
    if not isnull(fString) then 
    fString = Replace(fString, CHR(13), "") 
    fString = Replace(fString, CHR(10)& CHR(10), " ") 
    fString = Replace(fString, CHR(34), "") 
    fString = Replace(fString, CHR(10), "") 
    HTMLcode = fString 
    end if 
    end function

    下一條:固定位置的導航條

    上一條:新窗口打開新頁面居中的問題

棗莊西橋網絡微信小程序微信小程序

棗莊西橋網絡手機站二維碼掃描手機瀏覽

主站蜘蛛池模板: 少妇极品熟妇人妻专区视频| 在线播放真实国产乱子伦| 中文成人在线视频| 国产微拍精品| 狠狠色丁香婷婷| 久青草免费视频| 高清国产在线| 欧美v在线| 久久久精品无码一区二区三区| a免费毛片在线播放| 日本欧美视频在线观看| 无码中文字幕精品推荐| 中文字幕 91| 日本91在线| 在线毛片网站| 91九色国产porny| 57pao国产成视频免费播放| 97se亚洲综合| 国模沟沟一区二区三区| 国产精品护士| 天天色综网| 日日拍夜夜嗷嗷叫国产| 亚洲va欧美ⅴa国产va影院| 凹凸精品免费精品视频| 日本成人精品视频| 一级看片免费视频| 欧美一区二区福利视频| 蜜桃视频一区二区| 亚洲人成网站色7777| 999精品视频在线| 日本不卡在线播放| 久久国产精品麻豆系列| 无码AV日韩一二三区| 婷婷色中文| 亚洲欧美日韩天堂| 日本手机在线视频| 丁香综合在线| 中国成人在线视频| 亚洲永久精品ww47国产| 亚洲午夜福利精品无码| 国内精品久久久久鸭| 麻豆国产精品一二三在线观看| 久久久久青草大香线综合精品| 亚洲日韩精品伊甸| 日韩毛片在线播放| 日本亚洲国产一区二区三区| 女人爽到高潮免费视频大全| 国产高潮视频在线观看| 亚洲天堂网站在线| 欧美区一区二区三| 国产精品久久自在自线观看| 国产青榴视频| 亚洲精品动漫| 狠狠操夜夜爽| 国产美女精品人人做人人爽| 亚洲码在线中文在线观看| 2018日日摸夜夜添狠狠躁| 国产va免费精品观看| 在线日韩一区二区| 精品久久久久成人码免费动漫| 日韩精品专区免费无码aⅴ| 国产午夜人做人免费视频中文 | 欧美视频在线播放观看免费福利资源| 亚洲男人的天堂久久精品| 国产第八页| 久久黄色一级视频| 天堂av综合网| 99热这里只有免费国产精品 | 国产草草影院18成年视频| 久久婷婷国产综合尤物精品| 视频二区欧美| 久久国产精品嫖妓| 一级成人a毛片免费播放| 不卡无码h在线观看| 国产乱子精品一区二区在线观看| 国产精品永久免费嫩草研究院| a天堂视频| 三级欧美在线| 一级毛片在线免费视频| 国产精品爆乳99久久| 亚洲精品中文字幕午夜| 亚洲福利一区二区三区|