星期一, 十一月 08, 2004

如何在Javascript中得到多纬数族字符串下标

在Javascript中所有Object都是Hashtable对象的包装.
常用的数组用法:
一纬数组用法:
遍历数组:
MyObject=new Array();
MyObject=["a","b","c"];
for(var i=0;i<g;MyObject.length;i++)document.write(Myobject[i]);

多纬数组用法:
遍历数组:
MyObject = new Array();
MyObject[0]=["a","b","c"];
MyObject[10]=["a1","b1","c1"];

for(var i=0;i<g;MyObject[0].length;i++)document.write(Myobject[0][i]);

得到以定义的所有多纬数组的下标:
MyObject = new Array();
MyObject["name"]=["a","b","c"];
MyObject["high"]=["a1","b1","c1"];

用for..in 得到name,和high下标
for (var i in MyObject) {
document.write(i);
结果为:name,high