日期:2014-05-16  浏览次数:20359 次

超级着急!大神,怎么把这段json用js循环取生成带有链接的children子项html效果(如json数据下面)
var yixuan_navs = [ {
  "id" : "19",
  "name" : "\u90e8\u5c5e\u5355\u4f4d",
  "code" : "6-4",
  "children" : [{
  "id" : "34",
  "tid" : "19",
  "lid" : "0",
  "name" : "\u6cb3\u5317\u7701\u5de5\u4e1a\u548c\u4fe1\u606f\u5316\u5385",
  "domain" : "ii.gov.cn",
  "secdomain" : "",
  "url" : "http:\/\/www.ii.gov.cn\/index.html"
  }, {
  "id" : "42",
  "tid" : "19",
  "lid" : "0",
  "name" : "\u6e56\u5357\u7701\u5de5\u4e1a\u548c\u4fe1\u606f\u5316\u5385",
  "domain" : "hainan.gov.cn",
  "secdomain" : "",
  "url" : "http:\/\/iitb.hainan.gov.cn\/hnsgxt\/"
  }, {
  "id" : "56",
  "tid" : "19",
  "lid" : "0",
  "name" : "\u5409\u6797\u7701\u5de5\u4e1a\u548c\u4fe1\u606f\u5316\u5385",
  "domain" : "gxt.jl.gov.cn",
  "secdomain" : "",
  "url" : "http:\/\/gxt.jl.gov.cn\/"
  }]
}, {
  "id" : "21",
  "name" : "\u5171\u5efa\u9ad8\u6821",
  "code" : "6-6",
  "children" : []
}, {
  "id" : "23",
  "name" : "\u56fd\u9632\u79d1\u5de5\u529e",
  "code" : "6-7",
  "children" : [{
  "id" : "39",
  "tid" : "23",
  "lid" : "0",
  "name" : "\u6cb3\u5317\u7701\u56fd\u9632\u79d1\u5de5\u5c40",
  "domain" : "hbjg.gov.cn",
  "secdomain" : "",
  "url" : "http:\/\/www.hbjg.gov.cn\/"
  }, {
  "id" : "53",
  "tid" : "23",
  "lid" : "0",
  "name" : "\u6e56\u5357\u7701\u56fd\u9632\u79d1\u5b66\u6280\u672f\u5de5\u4e1a\u529e",
  "domain" : "hngfkgb.gov.cn",
  "secdomain" : "",
  "url" : "http:\/\/www.hngfkgb.gov.cn\/"
  }]
}]
效果: </head>
<body>
<div class="">
<div id="19">
<script type="text/javascript">
  document.write("\u90e8\u5c5e\u5355\u4f4d")
</script>
</div>
<ul class="">
<li id="34">
<a href="http:\/\/www.ii.gov.cn\/index.html">
<script type="text/javascript">
  document.write("\u6cb3\u5317\u7701\u5de5\u4e1a\u548c\u4fe1\u606f\u5316\u5385");
</script></a>
</li>

<li id="42">
<a href="http:\/\/iitb.hainan.gov.