惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

博客园 - ttyp

火苗-批量改名最新V1.0.5 喂来猫-超强工具集最新版 V1.0.9.0 使用MemberShip时,用HttpWebRequest抓数据 ASP.NET图形化的曲线图类 JS写的一个功能齐备的treeview控件 输入自动完成类 定时检查网站是否掉线的批处理 code collection 0.44版 发布 JS代码的格式化和压缩 JS代码混淆初步 OUTLOOK菜单类 WEB打印分页类(JS) - ttyp - 博客园 自动配置IE代理脚本 XP下IIS不能添加扩展名映射的BUG js编写的语法高亮引擎 INF文件格式小结 自动提示效果 超强的WEB表格组件 关于设置WebControls里的treeview控件的图片路径
js写的Hashtable类
ttyp · 2005-07-30 · via 博客园 - ttyp

<script language="javascript" type="text/javascript">

function Hashtable()
{
    
this._hash        = new Object();
    
this.add        = function(key,value){
                        
if(typeof(key)!="undefined"){
                            
if(this.contains(key)==false){
                                
this._hash[key]=typeof(value)=="undefined"?null:value;
                                
return true;
                            } 
else {
                                
return false;
                            }
                        } 
else {
                            
return false;
                        }
                    }
    
this.remove        = function(key){delete this._hash[key];}
    
this.count        = function(){var i=0;for(var k in this._hash){i++;} return i;}
    
this.items        = function(key){return this._hash[key];}
    
this.contains    = function(key){ return typeof(this._hash[key])!="undefined";}
    
this.clear        = function(){for(var k in this._hash){delete this._hash[k];}}

}

var a = new Hashtable();

a.add(
"aa");
a.add(
"bb",2342);
a.add(
"bb",2342);

a.remove(
"aa");

alert(a.count());

alert(a.contains(
"bb"));

alert(a.contains(
"aa"));

alert(a.items(
"bb"));


</script>

生活学习

posted @ 2005-07-30 23:24  ttyp  阅读(5548)  评论(6)    收藏  举报