function eachtest() {
var array = [ [ 12, 33 ], [ 234, 234 ], [ 435, 35 ], [ 123, 456 ] ]; $.each(array, function(i, item) { alert(item[0]); }); }//输出结果为12,234,435,123
function eachtest2(){ var json={key1:1,key2:2,key3:3}; $.each(json,function(key,it){ alert(key); }) }//输出结果为key1,key2,key3 function eachtest3(){ var json=[{name:"caomin",age:"23",niubi:"true"},{name:"xxx",age:"34",nx:"abc"}]; $.each(json,function(i,item){ alert(json[i].name); alert(json[i].age); alert(json[i].niubi); }) //遍历json格式的结果集:依次输出值: caomin,23,true, xxx,34 ,abc }