打印本文 打印本文  关闭窗口 关闭窗口
ASP 3.0高级编程(十八)
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005/9/10 12:34:27
               ‘Get all the keys into an array
arrItems = objMyData.Items                    ‘Get all the items into an array

For intLoop = 0 To objMyData.Count ?1        ‘Iterate through the array
    StrThisKey = arrKeys(intLoop)            ‘This is the key value
    StrThisItem = arrItems(intLoop)            ‘This is the item (data) value
Next

// In JScript
// Get VB-style arrays using the Keys() and Items() methods
var arrKeys = new VBArray(objMyData.Keys()).toArray();
var arrItems = new VBArray(objMyData.Items()).toArray();

for (intLoop = 0; intLoop < objMyData.Count; intLoop++) {
    // Iterate through the arrays
    strThisKey = arrKeys[intLoop];            // This is the key value
    strThisItem = arrItems[intLoop];            // This is the item (data) value
}
在VBScript里也可以使用For Each … Next语句完成同样的功能:
‘ Iterate the dictionary as a collection in VBScript
For Each objItem in arrItems
    Response.Write objItem & “ = “ & arrItems(objItem) & “<BR>”
Next

上一页  [1] [2] 



打印本文 打印本文  关闭窗口 关闭窗口