json格式的数据遍历【循环】 如果数据结构是这样 var data=[{name:"a",age:12},{name:"b",age:11},{name:"c",age:13},{name:"d",age:14}]; for(var o in data){ alert(o);//索引 0,1,2.... alert(data[o]);// {name:"a",age:12},{name:"b",age:11}.... alert("text:"+data[o].name+" value:"+data[o].age ); }
时间: 2024-10-03 21:42:14