ASP 定义常量的方法
常量:用一种名称代替数字和字符串,且其值保持一直不变。
在 VBscript 中,可以用 const 语句来定义常量。
常量分数字型和字符串型。
表示日期的常量写在两个 # 之间。
示例:
以下为引用内容: <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> ASP 定义常量 </title> </head> <body> <% const a=123456789 //定义的常量为数字 const b="<hr width=120 align='left'/>定义常量<hr width=120 align='left'/>>" //定义的常量为字符串 const c=# 2010-01-16 # //日期要写在两个# 之间 response.Write a response.Write b response.Write c %> </body> </html> |
运行结果:
123456789
定义常量
2010-01-16
本文链接:http://www.oversteper.com/wprogram/asp/826.html
转载于:https://blog.51cto.com/osteps/275777