一:
var arry=["a","b","c"];
$.each(arry,function(i,val){
alert(i);
alert(val);
})
i输出的的1,2,3,
val输出的是a,b,c,
二:
var arry =[["a","aa","aaa"],["b","bb","bbb"],["c","cc","ccc"]];
$.each(arry,function(i,val){
alert(i);
alert(val);
})
i输出的是:0,2,3,
val输出的是:["a","aa","aaa"],["b","bb","bbb"],["c","cc","ccc"]
三:
var arry=[["a","aa","aaa"],["b","bb","bbb"],["c","cc","ccc"]];;
$.each(arry,function(i,item){
$.each(item,function(k,vals){
alert(i);
alert(vals);
})
})
i输出的是:0,1,2,0,1,2,0,1,2,
vals:a,aa,aaa,b,bb,bbb,c,cc,ccc
时间: 2024-10-06 00:40:04