返回一個數組,其中包含了一個 Dictionary 對象中的全部現有的主鍵。
object.Keys( )
其中 object 總是一個 Dictionary 對象的名稱。
下面這段代碼說明了 Keys 方法的用法:
function KeysDemo(){var a, d, i, s; //創建一些變量。d = new ActiveXObject("Scrd.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); //返回結果。}
Add 方法 (Dictionary) Exists 方法 Items 方法 Remove 方法 RemoveAll 方法應用于: Dictionary 對象
新聞熱點
疑難解答