?
This document uses PHP Chinese website manual Release
JScript? | 語言參考 |
返回一個數(shù)組,其中包含了一個 Dictionary 對象中的全部現(xiàn)有的主鍵。
object.Keys( )
其中 object 總是一個 Dictionary 對象的名稱。
下面這段代碼說明了 Keys 方法的用法:
function KeysDemo() {
???var a, d, i, s;??????????????????//
創(chuàng)建一些變量。 ???d = new ActiveXObject("Scripting.Dictionary");
???d.Add ("a", "Athens");??????????????//
添加一些主鍵和條目。 ???d.Add ("b", "Belgrade");
???d.Add ("c", "Cairo");
???a = (new VBArray(d.Keys())).toArray();???//
獲得主鍵。 ???s = "";
???for (i in a)??????????????????//
遍歷dictionary
。 ???{ ??????s += a[i] + " - " + d(a[i]) + "<br>";
???}
???return(s);?????????????????????//
返回結(jié)果。 }
Add 方法 (Dictionary) | Exists 方法 | Items 方法 | Remove 方法 | RemoveAll 方法應(yīng)用于: Dictionary 對象