<select id="select1"></select>
<script src="
<script type="text/javascript">
var jsonData = { 'blogs': ['dudu', 'Artech', 'Fish Li'] }
$.each(jsonData.blogs, function (index, val) {
$("#select1").append("<option value='" + index + "'>" + val + "</option>")
})
</script>
生成的html
<select id="select1">
<option value="0">dudu</option>
<option value="1">Artech</option>
<option value="2">Fish Li</option>
</select>
<html><head>
<meta http-equiv=content-type content="text/htmlcharset=GBK">
</head>
<body>
<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td id="a">sdfsd</td>
</tr>
<tr>
<td id="b">sdfsdf</td>
</tr>
<tr>
<td id="c">sdfsd</td>
</tr>
<tr>
<td id="d">sdfsdf</td>
</tr>
</table>
</body>
<script>
var jsonStr = "{\"a\":\"内容1\", \"b\":\"内容2\",\"c\":\"内容3\",\"d\":\"内容4\"}"
var jsonObj = eval("(" + jsonStr + ")")
for(var property in jsonObj){
var nodeObj = document.getElementById(property)
if(nodeObj)
nodeObj.childNodes[0].nodeValue = jsonObj[property]
}
</script>
</html>