ASP Item 屬性

Item 屬性設置或返回 Dictionary 對象中某個專案的值。
語法
DictionaryObject.Item(key)[=newitem]
參數 | 描述 |
---|---|
key | 必需的。與 item 相關聯的 key。 |
newitem | 可選的。規定與 key 相關聯的值。 |
實例
<%
Dim d
Set d=Server.CreateObject("Scripting.Dictionary")
d.Add "re","Red"
d.Add "gr","Green"
d.Add "bl","Blue"
d.Add "pi","Pink"
Response.Write("The value of key pi is: " & d.Item("pi"))
%>
輸出:
The value of key pi is: Pink
Dim d
Set d=Server.CreateObject("Scripting.Dictionary")
d.Add "re","Red"
d.Add "gr","Green"
d.Add "bl","Blue"
d.Add "pi","Pink"
Response.Write("The value of key pi is: " & d.Item("pi"))
%>
輸出:
The value of key pi is: Pink
