最新的Web開發教程
 

ASP Keys方法


<完整字典對象參考

鑰匙方法返回在Dictionary對象的所有鍵的陣列。

句法

DictionaryObject.Keys

<%
dim d,a,i
set d=Server.CreateObject("Scripting.Dictionary")
d.Add "n","Norway"
d.Add "i","Italy"
d.Add "s","Sweden"

Response.Write("<p>Key values:</p>")
a=d.Keys
for i=0 to d.Count-1
  Response.Write(a(i))
  Response.Write("<br>")
next

set d=nothing
%>

Output:

Key values:

n
i
s

<完整字典對象參考