asp

位置:IT落伍者 >> asp >> 浏览文章

asp do while 循环语法与do while实例教程


发布日期:2022年03月24日
 
asp do while 循环语法与do while实例教程

在do while循环的另一种常用后 Next循环的循环在do while循环语句重复语句

块的次数不定重复的陈述或者当条件为真或直到条件变为True语法如下所示

Do [While|Until] condition
statements
Loop

Do
statements
Loop [While|Until] condition

在这方面这个循环内的代码将执行至少一次的情况在有一个例子

下面的例子定义了一个循环开始与i = 循环将继续运行因为我只要小于或等于

我将增加每次循环运行
Select ActionSelect AllTry It<%
Dim i use i as a counter
i = assign a value to i

Do While i<= Output the values from to
responsewrite(i & "<br >")
i = i + increment the value of i for next time loop executes
Loop
%>
现在让我们考虑一个更有用的例子创建下拉几天几个月或几年清单您可以使

用此登记表的代码例如

<%
creates an array
Dim month_array()
month_array() = "January"
month_array() = "February"
month_array() = "March"
month_array() = "April"
month_array() = "May"
month_array() = "June"
month_array() = "July"
month_array() = "August"
month_array() = "September"
month_array() = "October"
month_array() = "November"
month_array() = "December"

Dim i use i as a counter

responsewrite("<select name=""day"">" & vbCrLf)
i =
Do While i <=
responsewrite("<option value=" & i & ">" & i & "</option>" & vbCrLf)
i = i +
Loop
responsewrite("</select>")

responsewrite("<select name=""month"">" & vbCrLf)
i =
Do While i <=
responsewrite("<option value=" & i & ">" & month_array(i) & "</option>"

& vbCrLf)
i = i +
Loop
responsewrite("</select>")

responsewrite("<select name=""year"">")
i =
Do Until i =
responsewrite("<option value=" & i & ">" & i & "</option>" & vbCrLf)
i = i +
Loop
responsewrite("</select>")
%>

               

上一篇:asp文件上传错误'800a0005'的解决方法

下一篇:asp 简单读取数据表并列出来