高分求助实现下拉级联菜单的JS代码,急等
要求:不能用多维数组,因为实际过程中,下拉的数据量非常大,效率很低!
有朋友给我提供了以下一段代码,
但是仍是一团雾水。我希望最终实现的时候,能像java中的hashmap一样
function StockInfo()
{
this.code;
this.name;
this.count;
}
function StockInfoList()
{
this.stockArray = new Array();
this.add = function (name, code, count)
{
var aStock = new StockInfo;
aStock.name = name;
aStock.code = code;
aStock.count = count;
this.stockArray[aStock.code] = aStock;
}
this.getStock = function (code){
return this.stockArray[code]
}
}