receive是从后台传来的数据:2个list,list中各有两个json对象,使用网上给的代码获取key的值的时候返回4个值:list1,list,toJSONStringfunction,praseJSONfuction;前边两个是正确的,后边两个是怎么回事我就郁闷了,大侠们救命啊,在线等........
{"list1":[{"sid":"65657568768969","time":"12:00:00","topbox_number":"sudfngndyiturioyuoe345847rie","date":"2011-01-01","tsid":"7567567456235"},{"birthday":"1989-01-19","sex":"man","color":"color","watch":"watch","data_number":"01111","type":"type","date_time":"2011-03-03 12:00:00"}],
"list":[{"sid":"65657568768969","time":"12:00:00","topbox_number":"sudfngndyiturioyuoe345847rie","date":"2011-01-01","tsid":"7567567456235"},{"birthday":"1989-01-19","sex":"man","color":"color","watch":"watch","data_number":"01111","type":"type","date_time":"2011-03-03 12:00:00"}]}
var jos;
var receive=xmlHttp.responseText;
jos= eval('('+receive +')');
for(var item in jos){
alert( item+jos[item]);
}
{"list1":[{"sid":"65657568768969","time":"12:00:00","topbox_number":"sudfngndyiturioyuoe345847rie","date":"2011-01-01","tsid":"7567567456235"},{"birthday":"1989-01-19","sex":"man","color":"color","watch":"watch","data_number":"01111","type":"type","date_time":"2011-03-03 12:00:00"}],
"list":[{"sid":"65657568768969","time":"12:00:00","topbox_number":"sudfngndyiturioyuoe345847rie","date":"2011-01-01","tsid":"7567567456235"},{"birthday":"1989-01-19","sex":"man","color":"color","watch":"watch","data_number":"01111","type":"type","date_time":"2011-03-03 12:00:00"}]}
var jos;
var receive=xmlHttp.responseText;
jos= eval('('+receive +')');
for(var item in jos){
alert( item+jos[item]);
}
Object.prototype.toJSON=function(){}
<script type="text/javascript">
<!--
Object.prototype.toJSONString=function(){}
Object.prototype.praseJSON=function(){}
s = '{"list1":[{"sid":"65657568768969","time":"12:00:00","topbox_number":"sudfngndyiturioyuoe345847rie","date":"2011-01-01","tsid":"7567567456235"},{"birthday":"1989-01-19","sex":"man","color":"color","watch":"watch","data_number":"01111","type":"type","date_time":"2011-03-03 12:00:00"}],"list":[{"sid":"65657568768969","time":"12:00:00","topbox_number":"sudfngndyiturioyuoe345847rie","date":"2011-01-01","tsid":"7567567456235"},{"birthday":"1989-01-19","sex":"man","color":"color","watch":"watch","data_number":"01111","type":"type","date_time":"2011-03-03 12:00:00"}]}'
var jos;
var receive=s;
jos= eval('('+receive +')');
for(var item in jos){
alert( item+jos[item]);
} //-->
</script>
这说的前段js,和你后台没有什么关系,1楼的意思是:你是不是用了什么(js)框架,或者其他js代码扩充了js的Object(默认对象)的属性!
jsondata[j].name;
}
干吗一发发2个,原贴回答你的高手估计在这里就得不到分了。哎,可惜了!