http://www.csdn.net/develop/Read_Article.asp?Id=16947http://www.csdn.net/develop/Read_Article.asp?Id=15462简单的做法可以这样:var list = new Object();
list.add = function(key,value){this[key]=value}
list.get = function(key){return this[key]}list.add("emu","ston")
alert(list.get("emu"))
list.add = function(key,value){this[key]=value}
list.get = function(key){return this[key]}list.add("emu","ston")
alert(list.get("emu"))
<!-- var aa = new obj();
aa.add(1,"aa");
aa.add(2,"bb");
aa.show();
function obj()
{
this.content = new Array();
this.add=function(key,value)
{
this.content[this.content.length] = new Array(key,value);
}
this.show = function ()
{
for (var i=0;i<this.content.length;i++)
{
alert(this.content[i][0] +"," + this.content[i][1]);
}
}
}
//-->
</SCRIPT>
{
this.m_arrEntity = new Array();
this.addElement(oEntity)=function{this.m_arrEntity[this.m_arrEntity.length] = oEntity; }
this.empty()=function{this.m_arrEntity = null};
this.deleteElement(iIndex)=function{this.m_arrEntity.slice(0,nIndex - 1).concat(this.m_arrEntity.slice(nIndex + 1,this.m_arrEntity.length - 1))}
}
</script>
没有测试的