x
1
<p>访问 JSON 内嵌对象。</p>
2
3
<p id="demo"></p>
4
5
<script>
6
myObj = {
7
"name": "mifengjc",
8
"alexa": 10000,
9
"sites": {
10
"site1": "www.mifengjc.com",
11
"site2": "m.mifengjc.com",
12
"site3": "c.mifengjc.com"
13
}
14
}
15
document.getElementById("demo").innerHTML += myObj.sites.site1 + "<br>";
16
// 或
17
document.getElementById("demo").innerHTML += myObj.sites["site1"];
18
</script>