软件教程

asp中用for循环的一个小技巧

来源: 本站    类别: 软件教程    日期: 2013/9/2

 下面的代码是正确的,也是最常规的写法:

 

<%
dim i
for i=5 to 9
response.write i
next
%>


下面的代码是错误的,会提示缺少一个‘='的错误:
 

<%
dim i : i=5
for i to 9
response.write i
next
%>


下面的代码是正确的:

[/code]
<%
dim i
i=5
for i=i to 9
response.write i
next
%>
[/code]

第三段代码中,关键语法是:i=i,自己赋值给自己,解决缺少‘='的错误!

相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com