日期:2014-05-16 浏览次数:20505 次
var obj={"total":3,"rows":[{"tlatitude":34.255512,"tlongitude":108.943559},{"tlatitude":34.222488,"tlongitude":108.939365},{"tlatitude":34.225556,"tlongitude":108.9232}]};
var arr=new Array();
for(var i=0;i<obj.rows.length;i++){
arr.push(obj.rows[i].tlatitude);
}
alert(arr);
<script type="text/javascript">
var obj = [{ "id": 1 }, { "id": 2 }];
for (var i = 0; i < obj.length; i++) {
document.write(obj[i].id);
document.write('<br/>');
}
</script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/JavaScript">
var obj={"total":3,"rows":[{"tlatitude":34.255512,"tlongitude":108.943559},{"tlatitude":34.222488,"tlongitude":108.939365},{"tlatitude":34.225556,"tlongitude":108.9232}]};
var ar=new Array;
for(var i=0;i<obj.rows.length;i++){
ar[i]=obj.rows[i].tlatitude;
alert("第"+(i+parseInt(1))+"条数据结果为:"+ar[i]);
}
alert("全部数据结果为:"+ar);
//alert(obj.rows.length);
</script>