asp-classic - 如何在经典 ASP 中遍历集合?

标签 asp-classic vbscript

我希望能够做到:

For Each thing In things
End For

经典 ASP - 不是 .NET!

最佳答案

像这样的东西?

dim cars(2),x
cars(0)="Volvo"
cars(1)="Saab"
cars(2)="BMW"

For Each x in cars
  response.write(x & "<br />")
Next
www.w3schools.com .
如果要关联键和值 use a dictionary object反而:
Dim objDictionary
Set objDictionary = CreateObject("Scripting.Dictionary")
objDictionary.Add "Name", "Scott"
objDictionary.Add "Age", "20"
if objDictionary.Exists("Name") then
    ' Do something
else
    ' Do something else 
end if

关于asp-classic - 如何在经典 ASP 中遍历集合?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2300/

相关文章:

windows - 在目录中搜索字符串

mysql - Windows ODBC 驱动程序 - 检索到的表情符号数据呈现为?

javascript - ASP Classic 中的日历

asp.net - 了解 ASP.Net session 生命周期

vbscript - 检测触摸板的坐标

vbscript - 我的脚本不会在任务调度程序下运行。为什么?

asp-classic - 如何使用Python urlopen将参数传递给Url

vbscript - 从字典中检索数组似乎会产生深层复制

c# - 如何从 C# 应用程序在文本框中执行 VBScript 命令?

com - 为什么 CreateObject ("InternetExplorer.Application")会创建两个 iexplorer.exe 进程?