vbs 怎么定义二维数组和循环读取
在JS中定义:vara=[{u:"a1",d:"a2"},{u:"b1",d:"b2"}]读取:for(varbina){popub(a[b]["a"])popub(a[...
在JS中定义:
var a = [{
u: "a1",
d: "a2"
},{
u: "b1",
d: "b2"
}]
读取:
for (var b in a) {
popub(a[b]["a"])
popub(a[b]["b"])
}
请问用VBS怎么写
var a = [{
u: "a1",
d: "a2"
},{
u: "b1",
d: "b2"
}]
这个用vbs怎么写? 展开
var a = [{
u: "a1",
d: "a2"
},{
u: "b1",
d: "b2"
}]
读取:
for (var b in a) {
popub(a[b]["a"])
popub(a[b]["b"])
}
请问用VBS怎么写
var a = [{
u: "a1",
d: "a2"
},{
u: "b1",
d: "b2"
}]
这个用vbs怎么写? 展开
2个回答
展开全部
vbs的数组不支持key
你可以改用Dictionary对象或者Class
用Class:
Class Demo
Public u
Public d
End Class
Dim a(1)
Set a(0) = New Demo
a(0).u = "a1"
a(0).d = "a2"
Set a(1) = New Demo
a(1).u = "b1"
a(1).d = "b2"
Dim b
For b = 0 To Ubound(a)
Msgbox a[b].a
Msgbox a[b].b
Next
你可以改用Dictionary对象或者Class
用Class:
Class Demo
Public u
Public d
End Class
Dim a(1)
Set a(0) = New Demo
a(0).u = "a1"
a(0).d = "a2"
Set a(1) = New Demo
a(1).u = "b1"
a(1).d = "b2"
Dim b
For b = 0 To Ubound(a)
Msgbox a[b].a
Msgbox a[b].b
Next
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |