Excellent.  The 4guysfromrolla example is very helpful, thanks.  I've pasted a complete javascript.js file below which allows one to create a dictionary to make calls like the following:

var userDict = new Dictionary();

userDict.Add("smith", "admin");

userDict.Add("jones", "user");

userDict.Delete("jones");

var keys = userDict.Keys

for(var i=0; i<keys.length; i++)

{

alert((keys[i]+": "+userDict.Lookup(keys[i])));

}

Admittedly, the keys array is inefficient, but it's very handy in situations where the dictionary is small.

--Brett

//===========================================================================// Provides a Dictionary object for client-side java scripts//===========================================================================functionLookup(key){return(this[key]);}functionDelete(){for(c=0; c <Delete.arguments.length; c++){this[Delete.arguments[c]]=null;}// Adjust the keys (not terribly efficient)var keys =newArray()for(var i=0; i<this.Keys.length; i++){if(this[this.Keys[i]]!=null)
keys[keys.length]=this.Keys[i];}this.Keys= keys;}functionAdd(){for(c=0; c <Add.arguments.length; c+=2){// Add the propertythis[Add.arguments[c]]=Add.arguments[c+1];// And add it to the keys arraythis.Keys[this.Keys.length]=Add.arguments[c];}}functionDictionary(){this.Add=Add;this.Lookup=Lookup;this.Delete=Delete;this.Keys=newArray();}

最新文章

  1. MySQL主从复制中常见的3个错误及填坑方案
  2. Java内存管理和垃圾回收
  3. 爬虫学习----获取cookie
  4. LOAD TABLE tbl_name FROM MASTER语法 SQL
  5. python中时间和时区
  6. log4j打印参数
  7. iOS 获取通讯录权限的时机
  8. 【HDOJ】1076 An Easy Task
  9. GDI+ 颜色表示
  10. android方向键被锁定的问题
  11. [译]Stairway to Integration Services Level 6 - SSIS 工作流管理基础
  12. C#又能出来装个B了。一步一步微信跳一跳自动外挂
  13. how tomcat works 读书笔记 八 载入器下
  14. 【.NET Core项目实战-统一认证平台】第十一章 授权篇-密码授权模式
  15. Mac 常用的快捷键
  16. Day 5内存管理,定义变量
  17. 如何定制 antd 的样式(theme)
  18. 【SSL】OV、DV和EV证书的区别
  19. vue router.push(),router.replace(),router.go()和router.replace后需要返回两次的问题
  20. (9) MySQL主主复制架构使用方法

热门文章

  1. Django-分頁組件
  2. Distinct Subsequences ——动态规划
  3. Java学习笔记(九)——javabean
  4. 【JBPM4】判断节点decision 方法2 condition
  5. CentOS7安装Pycharm后无法使用日常的快捷键
  6. 查找文件which locate find
  7. python之md5模块
  8. Java工具类-格式化日期
  9. 洛谷P1940买蛋糕
  10. 读书笔记(javascript语言精粹)