选择显示字体大小

asp的函数详解

array()
  function: 返回一个数组
  syntax: array(list)
  arguments: 字符,数字均可
  example: <%
  dim myarray()
  for i = 1 to 7
  redim preserve myarray(i)
  myarray(i) = weekdayname(i)
  next
  %>

  result: 建立了一个包含7个元素的数组myarray
  myarray("sunday","monday", ... ... "saturday")

cint()
  function: 将一个表达式转化为数字类型
  syntax: cint(expression)
  arguments: 任何有效的字符均可
  example: <%
  f = "234"
  response.write cint(f) + 2
  %>

  result: 236
  转化字符"234"为数字"234",如果字符串为空,则返回0值

createobject()
  function: 建立和返回一个已注册的activex组件的实例。
  syntax: createobject(objname)
  arguments: objname 是任何一个有效、已注册的activex组件的名字.
  example: <%
  set con = server.createobject("adodb.connection")
  %>

  result:

cstr()
  function: 转化一个表达式为字符串.
  syntax: cstr(expression)
  arguments: expression 是任何有效的表达式。
  example: <%
  s = 3 + 2
  response.write "the result is: " & cstr(s)
  %>

  result: 转化数字“5”为字符“5”。

date()
  function: 返回当前系统日期.
  syntax: date()
  arguments: none.
  example: <%=date%>
  result: 8/4/99

dateadd()
  function: 返回一个被改变了的日期。
  syntax: dateadd(timeinterval,number,date)
  arguments: timeinterval is the time interval to add; number is amount of time intervals to add; and date is the starting date.
  example: <%
  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
  %>

  result: 11/4/99
  3:34:45 pm

  "m" = "month";
  "d" = "day";

  if currentdate is in time format then,
  "h" = "hour";
  "s" = "second";

datediff()
  function: 返回两个日期之间的差值 。
  syntax: datediff(timeinterval,date1,date2 [, firstdayofweek [, firstweekofyear>>)
  arguments: timeinterval 表示相隔时间的类型,如“m“表示“月”。
  example: <%
  fromdate = #8/4/99#
  todate = #1/1/2000#
  response.write "there are " & _
  datediff("d",fromdate,todate) & _
  " days to millenium from 8/4/99."
  %>

  result: 从8/4/99 到2000年还有 150 天.

day()
  function: 返回一个月的第几日 .
  syntax: day(date)
  arguments: date 是任何有效的日期。
  example: <%=day(#8/4/99#)%>
  result: 4

formatcurrency()
  function: 返回表达式,此表达式已被格式化为货币值
  syntax: formatcurrency(expression [, digit [, leadingdigit [, paren [, groupdigit>>>>)
  arguments: digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置;   leadingdigit 三态常数,指示是否显示小数值小数点前面的零。
  example: <%=formatcurrency(34.3456)%>
  result: $34.35

formatdatetime()
  function: 返回表达式,此表达式已被格式化为日期或时间
  syntax: formatdatetime(date, [, namedformat>)
  arguments: namedformat 指示所使用的日期/时间格式的数值,如果省略,则使用 vbgeneraldate.
  example: <%=formatdatetime("08/4/99", vblongdate)%>
  result: wednesday, august 04, 1999

formatnumber()
  function: 返回表达式,此表达式已被格式化为数值.
  syntax: formatnumber(expression [, digit [, leadingdigit [, paren [, groupdigit>>>>)
  arguments: digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; leadingdigit i指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; paren 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; groupdigit i指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。.
  example: <%=formatnumber(45.324567, 3)%>
  result: 45.325

formatpercent()
  function: 返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 100 )。 (%)
  syntax: formatpercent(expression [, digit [, leadingdigit [, paren [, groupdigit>>>>)
  arguments: 同上.
  example: <%=formatpercent(0.45267, 3)%>
  result: 45.267%

hour()
  function: 以24时返回小时数.
  syntax: hour(time)
  arguments:
  example: <%=hour(#4:45:34 pm#)%>
  result: 16
  (hour has been converted to 24-hour system)

instr()
  function: 返回字符或字符串在另一个字符串中第一次出现的位置.
  syntax: instr([start, > strtobesearched, strsearchfor [, compare>)
  arguments: start为搜索的起始值,strtobesearched接受搜索的字符串 strsearchfor要搜索的字符compare 比较方式(详细见asp常数)
  example: <%
  strtext = "this is a test!!"
  pos = instr(strtext, "a")
  response.write pos
  %>

  result: 9

instrrev()
  function: 同上,只是从字符串的最后一个搜索起
  syntax: instrrev([start, > strtobesearched, strsearchfor [, compare>)
  arguments: 同上.
  example: <%
  strtext = "this is a test!!"
  pos = instrrev(strtext, "s")
  response.write pos
  %>

  result: 13


int()
  function: 返回数值类型,不四舍五入。
  syntax: int(number)
  arguments:
  example: <%=int(32.89)%>
  result: 32

isarray()
  function: 判断一对象是否为数组,返回布尔值 .
  syntax: isarray(name)
  arguments:
  example: <%
  strtest = "test!"
  response.write isarray(strtest)
  %>

  result: false

isdate()
  function: 判断一对象是否为日期,返回布尔值
  syntax: isdate(expression)
  arguments: expression is any valid expression.
  example: <%
  strtest = "8/4/99"
  response.write isdate(strtest)
  %>

  result: true

isempty()
  function: 判断一对象是否初始化,返回布尔值.
  syntax: isempty(expression)
  arguments:
  example: <%
  dim i
  response.write isempty(i)
  %>

  result: true

isnull()
  function: 判断一对象是否为空,返回布尔值.
  syntax: isnull(expression)
  arguments:
  example: <%
  dim i
  response.write isnull(i)
  %>

  result: false
  
isnumeric()
  function: 判断一对象是否为数字,返回布尔值.
  syntax: isnumeric(expression)
  arguments:
  example: <%
  i = "345"
  response.write isnumeric(i)
  %>

  result: true
  就算数字加了引号,asp还是认为它是数字。

isobject()
  function: 判断一对象是否为对象,返回布尔值.
  syntax: isobject(expression)
  arguments:
  example: <%
  set con = server.createobject("adodb.connection")
  response.write isobject(con)
  %>

  result: true


lbound()
  function: 返回指定数组维的最小可用下标.
  syntax: lbound(arrayname [, dimension>)
  arguments: dimension 指明要返回哪一维下界的整数。使用 1 表示第一维,2 表示第二维,以此类  推。如果省略 dimension 参数,默认值为 1.
  example: <%
  i = array("monday","tuesday","wednesday")
  response.write lbound(i)
  %>

  result: 0

lcase()
  function: 返回字符串的小写形式
  syntax: lcase(string)
  arguments: string is any valid string expression.
  example: <%
  strtest = "this is a test!"
  response.write lcase(strtest)
  %>

  result: this is a test!

left()
  function: 返回字符串左边第length个字符以前的字符(含第length个字符).
  syntax: left(string, length)
  arguments:
  example: <%
  strtest = "this is a test!"
  response.write left(strtest, 3)
  %>

  result: thi

len()
  function: 返回字符串的长度.
  syntax: len(string varname)
  arguments:
  example: <%
  strtest = "this is a test!"
  response.write len(strtest)
  %>

  result: 15

ltrim()
  function: 去掉字符串左边的空格.
  syntax: ltrim(string)
  arguments:
  example: <%
  strtest = " this is a test!"
  response.write ltrim(strtest)
  %>

  result: this is a test!

mid()
  function: 返回特定长度的字符串(从start开始,长度为length).
  syntax: mid(string, start [, length>)
  arguments:
  example: <%
  strtest = "this is a test! today is monday."
  response.write mid(strtest, 17, 5)
  %>

  result: today

minute()
  function: 返回时间的分钏.
  syntax: minute(time)
  arguments:
  example: <%=minute(#12:45:32 pm#)%>
  result: 45

month()
  function: 返回日期.
  syntax: month(date)
  arguments: date is any valid date expression.
  example: <%=month(#08/04/99#)%>
  result: 8

monthname()
  function: returns a string identifying the specified month.
  syntax: monthname(month, [, abb>)
  arguments: month is the numeric representation for a given month; abb (optional) is a boolean value used to display month abbreviation. true will display the abbreviated month name and false (default) will not show the abbreviation.
  example: <%=monthname(month(#08/04/99#))%>
  result: august

now()
  function: returns the current system date and time.
  syntax: now()
  arguments: none
  example: <%=now%>
  result: 8/4/99 9:30:16 am

replace()
  function: returns a string in which a specified sub-string has been replaced with another substring a specified number of times.
  syntax: replace(strtobesearched, strsearchfor, strreplacewith [, start [, count [, compare>>>)
  arguments: strtobesearched is a string expression containing a sub-string to be replaced; strsearchfor is the string expression to search for within strtobesearched; strreplacewith is the string expression to replace sub-string strsearchfor; start (optional) is the numeric character position to begin search; count (optional) is a value indicating the comparision constant.
  example: <%
  strtest = "this is an apple!"
  response.write replace(strtest, "apple", "orange")
  %>

  result: this is an orange!

right()
  function: 返回字符串右边第length个字符以前的字符(含第length个字符).
  syntax: right(string, length)
  arguments: .
  example: <%
  strtest = "this is an test!"
  response.write right(strtest, 3)
  %>

  result: st!

rnd()
  function: 产生一个随机数.
  syntax: rnd [ (number) >
  arguments:
  example: <%
  randomize()
  response.write rnd()
  %>

  result: 任何一个在0 到 1 之间的数

round()
  function: 返回按指定位数进行四舍五入的数值.
  syntax: round(expression [, numright>)
  arguments: numright数字表明小数点右边有多少位进行四舍五入。如果省略,则 round 函数返回整数.
  example: <%
  i = 32.45678
  response.write round(i)
  %>

  result: 32

rtrim()
  function: 去掉字符串右边的字符串.
  syntax: rtrim(string)
  arguments:
  example: <%
  strtest = "this is a test!! "
  response.write rtrim(strtest)
  %>

  result: this is a test!!

second()
  function: 返回秒.
  syntax: second(time)
  arguments: .
  example: <%=second(#12:34:28 pm#)%>
  result: 28

strreverse()
  function: 反排一字符串
  syntax: strreverse(string)
  arguments:
  example: <%
  strtest = "this is a test!!"
  response.write strreverse(strtest)
  %>

  result: !!tset a si siht

time()
  function: 返回系统时间.
  syntax: time()
  arguments: .
  example: <%=time%>
  result: 9:58:28 am

trim()
  function: 去掉字符串左右的空格.
  syntax: trim(string)
  arguments: string is any valid string expression.
  example: <%
  strtest = " this is a test!! "
  response.write trim(strtest)
  %>

  result: this is a test!!

ubound()
  function: 返回指定数组维数的最大可用下标.
  syntax: ubound(arrayname [, dimension>)
  arguments: dimension (optional) 指定返回哪一维上界的整数。1 表示第一维,2 表示第二维,以此类推。如果省略 dimension 参数,则默认值为 1.
  example: <%
  i = array("monday","tuesday","wednesday")
  response.write ubound(i)
  %>

  result: 2

ucase()
  function: 返回字符串的大写形式.
  syntax: ucase(string)
  arguments:
  example: <%
  strtest = "this is a test!!"
  response.write ucase(strtest)
  %>

  result: this is a test!!

vartype()
  function: 返回指示变量子类型的值
  syntax: vartype(varname)
  arguments:
  example: <%
  i = 3
  response.write vartype(i)
  %>

  result: 2(数字)详见"asp常数"

weekday()
  function: 返回在一周的第几天.
  syntax: weekday(date [, firstdayofweek>)
  arguments: .
  example: <%
  d = #8/4/99#
  response.write weekday(d)
  %>

  result: 4(星期三)

weekdayname()
  function: 返回一周第几天的名字.
  syntax: weekdayname(weekday [, abb [, firstdayofweek>>)
  arguments: abb可选。boolean 值,指明是否缩写表示星期各天的名称。如果省略, 默认值为 false,即不缩写星期各天的名称.firstdayofweek指明星期第一天的数值
  example: <%
  d = #8/4/99#
  response.write weekdayname(weekday(d))
  %>

  result: wednesday

year()
  function: 返回当前的年份.
  syntax: year(date)
  arguments:
  example: <%=year(#8/4/99#)%>
  result: 1999

出处:
责任编辑:51windows

◎进入论坛网络编程版块参加讨论

相关文章 更多相关链接
[asp]利用 xmlhttp 分块上传文件
asp 中健壮的页结构的异常处理
改进 asp 的字符串处理性能
asp 指南
asp编程入门进阶
作者文章 更多作者文章
ati壁纸大赛 22000 元等你来
photoshop cs 做“魔眼”
优派·生活真彩qqskin设计大赛
揭开svchost.exe进程之谜
全球优秀广告设计赏析
idea.com" method=get style="margin:0px; padding:0px;">idea.com">idea.com/img/google_search_title.gif;s:http://www.blueidea.com;forid:1;">
全网 idea.com';this.form.bisearch.value='cms';form.searchby.style.display='';document.getelementbyid('keyword').style.width='70px';">本站 idea.com';this.form.bisearch.value='bbs';form.searchby.style.display='none';document.getelementbyid('keyword').style.width='132px';">论坛
热门搜索:css fireworks 设计比赛 网页制作 dreamweaver studio8 flash
站点最新 站点最新列表
保持清晰的文档结构
月亮图腾教程ⅴ—最后一战
x-sapce使用系列教程
x-space安装系列教程
抽线以及虚线画法简明教程
创新设计 百万格子大楼
discuz!转换系列教程
世界杯足球的32个变种
易上手简单图层样式扣图
一封写给mm学习linux的信
栏目最新 栏目最新列表
保持清晰的文档结构
月亮图腾教程ⅴ—最后一战
x-sapce使用系列教程
x-space安装系列教程
抽线以及虚线画法简明教程
discuz!转换系列教程
易上手简单图层样式扣图
十分钟学会 xajax
css 菜单举一反三
利用照片制作版画简明教程

蓝色理想版权申明:除部分特别声明不要转载,或者授权我站独家播发的文章外,大家可以自由转载我站点的原创文章,但原作者和来自我站的链接必须保留(非我站原创的,按照原来自一节,自行链接)。文章版权归我站和作者共有。

转载要求:转载之图片、文件,链接请不要盗链到本站,且不准打上各自站点的水印,亦不能抹去我站点水印。

特别注意:本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

本文总共有 12 条评论,现在显示最新的 5 条。暂时没有人参于评分


202.118.197.40 publish at 2004-4-30 18:55:03
很好的,分类比较清晰的,
218.58.225.231 publish at 2004-2-7 15:44:23
下边的错了:qq:330793500
218.58.225.231 publish at 2004-2-7 15:42:21
还可以。谁会做留言板,教教我?qq:79058569
61.52.142.149 publish at 2003-12-24 23:19:10
very good
61.174.196.209 publish at 2003-12-24 9:08:11
good

查看全部评论

asp" method="post" onsubmit="submit.disabled=true;">
您的评论
用户名:  口令:
说明:输入正确的用户名和密码才能参与评论。如果您不是本站会员,你可以注册 为本站会员。
注意:文章中的链接、内容等需要修改的错误,请用报告错误,以利文档及时修改。
不评分12345
注意:请不要在评论中含与内容无关的广告链接,违者封id
请您注意:
·不良评论请用报告管理员,以利管理员及时删除。
·尊重网上道德,遵守中华人民共和国的各项有关法律法规
·承担一切因您的行为而直接或间接导致的民事或刑事法律责任
·本站评论管理人员有权保留或删除其管辖评论中的任意内容
·您在本站发表的作品,本站有权在网站内转载或引用
·参与本评论即表明您已经阅读并接受上述条款
推荐文档 打印文档 评论文档 报告错误  
专业书推荐 更多内容
flash第一步系列》
《交互设计之路》
dreamweaver 从基础到实践》
《色彩管理》
网页设计专家门诊》
《情感化设计》
gui设计禁忌》
html>


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons