技术文章
首页
关于我们
网站模板
客户案例
网站建设
程序开发
联系我们
技术文章
seo
asp.net
JavaSript
asp
网站建设
JAVASCRIPT HashTable
时间:2007-01-22 点击:119
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"));
javascript编程起步(第二课)
javascript编程起步(第一课)
javascript 对象的定义方法
Prototype使用指南之form.js
JAVASCRIPT HashTable
> 返回
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络
Product
All Rights Reserved