<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3xue教程(w3xue.com)</title>
</head>
<body>
<p>访问 JSON 内嵌对象。</p>
<p id="demo"></p>
<script>
myObj = {
"name":"W3xue",
"alexa":10000,
"sites": {
"site1":"www.w3xue.com",
"site2":"m.w3xue.com",
"site3":"c.w3xue.com"
}
document.getElementById("demo").innerHTML += myObj.sites.site1 + "<br>";
// 或者
document.getElementById("demo").innerHTML += myObj.sites["site1"];
</script>
</body>
</html>