如果 dictionary 对象中存在所指定的主键则返回 true,否则返回 false。
object.exists(key)
参数
object
必选项。总是一个 dictionary 对象的名称。
key
必选项。需要在 dictionary 对象中搜索的 key 值。
下面这个例子说明了 exists 方法的用法。
function keyexists(k){var fso, s = "";d = new activexobject("scripting.dictionary");d.add("a", "athens");d.add("b", "belgrade");d.add("c", "cairo");if (d.exists(k))s += "specified key exists.";elses += "specified key doesn't exist.";return(s);}
请参阅
add 方法 (dictionary) | items 方法 | keys 方法 | remove 方法 | removeall 方法应用于: dictionary 对象
闽公网安备 35060202000074号