标签:json
<script type="text/javascript">
var person={
name:"李卫康",
age:23
}
alert(person.name);
</script>
3.数组格式
<script type="text/javascript">
var person=[
{
name:"李卫康",
age:25
},
{
name:"程崇树",
age:21
}
];
alert(person[1].name)
</script>
4.键值对和数组的混合模式
<script type="text/javascript">
var person = {
"jpm":
[
{
name : "程崇树",
age : 18,
sex : "male"
},
{
name : "翁总顺",
age : 18,
sex : "female"
}
],
"ytclj":
[
{
name : "李卫康",
age : 18,
sex : "male"
},
{
name : "韩玮",
age : 18,
sex : "female"
}
]
}
alert(person.jpm[0].name);
</script>
5.键值对的方法
<script type="text/javascript">
var method={
add: function(a,b){
return a+b;
}
}
alert(method.add(1,5));
</script>
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:json
原文地址:http://blog.csdn.net/u014010769/article/details/46860369