您的位置:首页 > Web前端 > JavaScript

js 操作json数据

2010-08-05 15:30 344 查看
今天的收获了以下知识,在这里在感谢【人生如梦】



<script type="text/javascript">
function showJSON() {
var user =
{
"username":"liang",
"age":20,
"info": { "tel": "tel", "phone": "phone"},
"address": [{"city":"city","postcode":"postcode"} ]
}
alert(user.username);
alert(user.age);
alert(user.info.tel);
alert(user.address[0].city);
alert(user.address[0].postcode);
}

</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: