function printObject(obj) {
//obj = {"cid":"C0","ctext":"区县"};
var temp = "";
for (var i in obj) { //用javascript的for/in循环遍历对象的属性
temp += i + ":" + obj[i] + "\n";
}
//alert(obj); //结果:[object Object]
//console.log(obj); //使用firebug查看结果
alert(temp); //结果:cid:C0 \n ctext:区县
}
---------------------
作者:mezheng
来源:CSDN
原文:https://blog.csdn.net/mezheng/article/details/78538373
版权声明:本文为博主原创文章,转载请附上博文链接!
原文地址:https://www.cnblogs.com/asdyzh/p/9818586.html
时间: 2024-10-01 05:38:50