|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
ASP中很多函数,大家在学习函数时要重点把握:函数名,函数功能,函数返回值和例题。 1.函?滇rray() 功能:??建一???到M??量 格式:array(list) ???岛list ???到M??量中的每???抵盗鞋中殓用逗??殓隔 例子: <% i = array ("1","2",3) %> 劫果: i 被嬴予???到M 2.函?得int() 功能:?⒁槐磉_式/其它??型的??量弈?Q成整?殿?型(int) 格式:Cint(expression) ???岛expression 是任何有效的表哌式/其它??型的??量 例子: <% f = "234" response.write cINT(f) + 2 %> 劫果: 236 函?得int()?⒆址?"234"弈?Q 成整?挡34.假如表哌式?榭宅 或者?o效?r,返回值?榘; 3.函?岛Creatobject() 功能:??建及返回一??ActiveX?ο螽 格式:Creatobject(obname) ???岛obname 是?ο蟮拿?费 例子: <% Set con = Server.CreateObject("ADODB.Connection") %> 劫果: 4.函?得str() 功能:?⒁槐磉_式/其它??型的??量弈?Q成字符??型(string) 格式:Cstr(expression) ???岛expression是任何有效的表哌式/其它??型的??量 例子: <% s = 3 + 2 response.write "The result is: " & cStr(s) %> 劫果:函?得str()?⒄??? 5 弈?Q 成字符"5". 5.函?的ate() 功能:返回??前系靳(server端)的日期 格式:Date() ???岛?o 例子<% date () %> 劫果:05/10/00 6.函?的ateadd() 功能:??算某??指定的?r殓和 格式:dateadd(timeinterval,number,date) ???岛timeinterval是?r殓?挝花月,日..); number是?r殓殓隔值,date是?r殓始?c. 例子: <% 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 格式,?t, "h" = "hour"; "s" = "second"; 7.函?的atediff() 功能:??算某量??指定的?r殓差 格式:datediff(timeinterval,date1,date2[,firstdayofweek[,firstdayofyear]]) ???岛timeinterval 是?r殓?挝换 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.函?典ay() 功能:返回一??整?抵惮????于某月的某日 格式:day(date) ???岛date是一??有效的日期表哌式; 例子lt;% =date(#8/4/99#) %> 劫果:4 9.函?垫ormatcurrency() 功能:弈?Q成???鸥袷郊br> 格式:formatcurrency(expression [,digit[,leadingdigit[,paren[,groupdigit]]]]) ???岛expression 是有效的?底直磉_式;digit表示小?迭c后的位?祷leadingdigit,paren,groupdigit是任意啉??. 例子<%=FormatCurrency(34.3456)%> 劫果34.35 10.函?灯ormatdatetime() 功能:格式化日期表哌式/??量 格式:formatdatetime(date[,nameformat]) ???岛date?橛行У娜掌诒磉_式/??量;nameformat是指定的日期格式常量名费. 例子<% =formatdatetime("08/04/99",vblongdate) %> 劫果:Wednesday,August 04,1999 21.函?瞪snumeric() 功能:返回一??布??值,判?嘧?量是否???底肿?量,或者是可以弈?Q成?底值钠渌???量. 格式:isnumeric(expression) ???岛expression 是任意的??量. 例子: <% i="234" response.write isnumeric(i) %> 劫果: true. 22.函?瞪sobject() 功能:返回一??布??值,判?嘧?量是否???ο蟮淖?量, 格式:isobject(expression) ???岛expression 是任意的??量. 例子: <% set con =server.creatobject("adodb.connection") response.write isobject(con) %> 劫果: true 23.函?岛Lbound() 功能:返回一???到M的下界. 格式:Lbound(arrayname[,dimension]) ???岛arrayname 是?到M??量,dimension 是任意?? 例子: <% i = array("1","2","3") response.write lbound(i) %> 劫果:0 返回类别: 教程 上一教程: 小偷程序大揭秘 下一教程: ASP与数据库连接方式的具体讲解 您可以阅读与"ASP 函数介绍(一)"相关的教程: · ASP 函数介绍(二) · Asp 函数介绍(一) · 一个asp函数, 解决SQL Injection漏洞 · ASP 中 SPLIT 函数的实例 · ASP里使用MD5加密的函数及示例 |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |