首页 > 学院 > 开发设计 > 正文

Keys 方法

2019-11-18 11:08:51
字体:
来源:转载
供稿:网友

 

返回一个数组,其中包含了一个 Dictionary 对象中的全部现有的主键。

object.Keys( )

其中 object 总是一个 Dictionary 对象的名称。

说明

下面这段代码说明了 Keys 方法的用法:

function KeysDemo(){   var a, d, i, s;                  //创建一些变量。   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);                     //返回结果。}

请参阅

Add 方法 (Dictionary) Exists 方法 Items 方法 Remove 方法 RemoveAll 方法应用于: Dictionary 对象



上一篇:Items 方法

下一篇:Move 方法

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表