按照你的情况,写了个范例!
是这样的多维遍历么?
递归判断当前类型即可!
1 <script type="text/javascript">
2 function recursion(obj)
3 {
4 document.write("\n");
5 for (var key in obj)
6 {
7 var o = obj[key];
8 if (typeof(o) == 'object')
9 recursion(o);
10 else
11 document.write(o + ", ");
12 }
13 }
14 document.write("<pre>");
15 recursion([1, 2, [31, 32, 33, [44, 45, [55, 56, [77, 78, [88, 89, [99, 100]]]]]]]);
16 document.write("</pre>");
17 </script>
使用递归试试