在For Each Next循环类似对于 Next循环而不是重复陈述的指定的次数
每名 Next循环重复的对象集合为数组中的每个元素的声明(或每个项目)
下面的代码片断创建下拉列表中选择其中一个数组元素
Select ActionSelect AllTry It<%
Dim bookTypes() creates first array
bookTypes()="Classic"
bookTypes()="Information Books"
bookTypes()="Fantasy"
bookTypes()="Mystery"
bookTypes()="Poetry"
bookTypes()="Humor"
bookTypes()="Biography"
bookTypes()="Fiction"
Dim arrCars() creates second array
arrCars()="BMW"
arrCars()="Mercedes"
arrCars()="Audi"
arrCars()="Bentley"
arrCars()="Mini"
Sub createList(some_array) takes an array and creates dropdown list
dim i
responsewrite("<select name=""mylist"">" & vbCrLf) vbCrLf stands for
Carriage Return and Line Feed
For Each item in some_array
responsewrite("<option value=" & i & ">" & item & "</option>" &
vbCrLf)
i = i +
Next repeat the code and move on to the next value of i
responsewrite("</select>")
End Sub
Now lets call the sub and print out our lists on the screen
Call createList(bookTypes) takes bookTypes array as an argument
Call createList(arrcars) takes arrCars array as an argument
%>