日期:2014-05-16 浏览次数:20481 次
[
{"id": 123, "con": "gggdfg"},
{"id": 124, "con": "jgjjghj"},
{"id": 125, "con": "khkhk"},
{"id": 126, "con": "ggtyuryrty"},
{"id": 127, "con": "dfsfsf"}
]
<script>
d = [
{"id": 123, "con": "gggdfg"},
{"id": 124, "con": "jgjjghj"},
{"id": 125, "con": "khkhk"},
{"id": 126, "con": "ggtyuryrty"},
{"id": 127, "con": "dfsfsf"}
];
for(i=0; i<(d.length); i++)
if(d[i].id == 125) alert(d[i].con);
</script>
var t2 = [
{"id": 123, "con": "gggdfg"},
{"id": 124, "con": "jgjjghj"},
{"id": 125, "con": "khkhk"},
{"id": 126, "con": "ggtyuryrty"},
{"id": 127, "con": "dfsfsf"}
];
var myobj=eval(t2);
for(var i=0;i<myobj.length;i++){
alert(myobj[i].id);
alert(myobj[i].con);
}
var arr1 = [
{ "id": 123, "con": "gggdfg" },
{ "id": 124, "con": "jgjjghj" },
{ "id": 125, "con": "khkhk" },
{ "id": 126, "con": "ggtyuryrty" },
{ "id": 127, "con": "dfsfsf" }
];
var arr2 = new Array;
for (var i = 0; i < arr1.length; i++) {
arr2[ar