html 显示JSON

<html>
<body>
<h2>在 JavaScript 中创建 JSON 对象</h2>

<p>
Name: <span id="resultcode"></span><br />
Age: <span id="reason"></span><br />
Address: <span id="SB"></span><br />
Phone: <span id="jphone"></span><br />
</p>

<script type="text/javascript">
var JSONObject= {
 "resultcode": "200",
  "reason": "查询成功",
  "SB":"我是一个大",
  };
document.getElementById("resultcode").innerHTML=JSONObject.resultcode
document.getElementById("reason").innerHTML=JSONObject.reason
document.getElementById("SB").innerHTML=JSONObject.SB
</script>

</body>
</html>

Copyright Liukaiweb.Com Rights Reserved.

 渝ICP备2021008408号-5