明天的明天 永远的永远 未知的一切 我与你一起承担 ??

是非成败转头空 青山依旧在 几度夕阳红 。。。
随笔 - 1277, 文章 - 0, 评论 - 214, 阅读 - 320万
  博客园  :: 首页  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

asp 自学总结 [1]

Posted on   且行且思  阅读(264)  评论(0编辑  收藏  举报

<%@ language=JScript%>   标识你的ASP代码用什么脚本语言

ASP中可以写 VB也可写JS随你喜好,以下主要为vb

脚本语言:javascript 和 vbscript 都为脚本语言,如果,标识<%@ language= %>
则为IIS默认的脚本语言。

变量的声明用Dim public private
<%Dim i,k%>   如果不声明 默认为隐式声明

运算符--算术运算符
-   *   /   \(整除)   Mod   +    -   &(字符串的连接)
运算符--比较运算符
=   <>(不等)   <   >   <=   >=
运算符--比较运算符
NOT AND OR   (与或非)

IF语句
<%
if a>12 then
response.write "11111"
else
response.write "2222"
end if
%>

for循环
<%
for j=1 to 10
response.write "me"
next
%>

now()  当前时间

常量的定义:(const)
数字:const s=6
字符串:const s="gg"
时间:const #2009-01-12#

条件语句(if..then..else   select case)
<%
if a<5 then
response.write "111"
elseif a<10 then
response.write "222"
else
response.write "333"
end if
%>

<%
dim a
a=10
select case a
case 1,2,3,4
response.write "1"
case 5,6,7,8
response.write "2"
case 9,10
response.write "3"
%>

循环语句
do...loop        条件为真循环
while...wend     条件为真循环
for...next       指定循环次数
foreach...next   对数组或集合进行循环

第一种:相当于C中while循环
<%
do while
....
loop
%>
第二种:相当于C中do...while循环
<%
do
....
loop while
%>
例子:
<%
do while a<10
response.write "aaaa"
a = a+1
loop
%>

<%
for i=1 to 10 step 2       //step步长为2
response.write "ddd<br>"
next
%>

过程(函数)
sub/function   区别在于sub无返回值,而function有返回值
定义:
sub a()
msgbox "haha"
end sub
调用 call a()

sub mm(a,b)
msgbox (a&b)
end sub
调用 call a("dd","cc")

<%
function a()
....
end function
%>

编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
点击右上角即可分享
微信分享提示