|
A Dictionary object example
This example shows how to use the Dictionary object
this as the name suggests is like an actual dictionary in which
you attach a keyword to a piece of information . You can then
find the information by supplying the necessary keyword . In
this example we have entered 3 web sites and will display the
information about the ASP site.
Code:
<%
Dim objDict , strValue
'create an instance of the dictionary object
Set objDict = Server.CreateObject("Scripting.Dictionary")
'add 3 entries to the dictionary object
objDict.Add "ASP site" , "http://asp.myscripting.com"
objDict.Add "VBScript site" , "http://vbscript.myscripting.com"
objDict.Add "JavaScript site" , "http://javascript.myscripting.com"
'now we will display one of the items , we will choose the ASP
site
'store the value associated with ASP site in strValue
strValue = objDict.Item("ASP site")
'display the value
Response.Write "ASP site is " & strValue
Set objDict = Nothing
%>
|