ASP Item Property
The ASP Item Property is used to return or set the value of an item in the Dictionary Object.
Syntax:
DictionaryObject.Item(key)[=newitem]
Parameter Values:
- key: It specifies the key that is associated with an item. It is a required attribute.
- newitem: It specifies the new item that has to be set for the given key.
Example: The below code demonstrates the ASP Dictionary.Item Property.
ASP
<%Dim dict 'Create a new dictionarySet dict=Server.CreateObject("Scripting.Dictionary") 'Add values to the dictionarydict.Add "g","green"dict.Add "r","red"dict.Add "p","purple" 'Getting a value from the dictionaryResponse.Write("Value of key 'p' is: " & dict.Item("p")) 'Setting a new value to the keydict.Item("p") = "violet" 'Getting the value again from the dictionaryResponse.Write("<br>Value of key 'p' is: " & dict.Item("p"))%> |
Output:
Value of key 'p' is: purple Value of key 'p' is: violet



