<div class="codetitle"> <span><a style="CURSOR: pointer" data="24307" class="copybut" id="copybut24307" onclick="doCopy('code24307')"><u>코드 복사</u></a></span> 코드는 다음과 같습니다.</div> <div class="codebody" id="code24307"> <br><script type="text/javascript"> <br> var d1 =[{"text":"Wangjiawan","value":"9"},{"text":"Lijiawan","value":"10"},{"text":"샤오 Jiawan","value":"13"}]; <br>$(d1).each(function(){ <br>alert(this.text " " this.value); <br>}); <br></script> <br> </div> <br>JQuery 필요 없음 <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="2281" class="copybut" id="copybut2281" onclick="doCopy('code2281')"><u>코드 복사</u></a></span> 코드는 다음과 같습니다. :</div> <div class="codebody" id="code2281"> <br><script type="text/javascript"> <br>var json = {"options":"[{"text":"Wangjiawan","value":"9 "}, {"text":"Lijiawan","value":"10"},{"text":"Shaojiawan","value":"13"}]"} <br>json = eval(json . options) <br>for(var i=0; i<json.length; i ) <br>{ <br>alert(json[i].text " " json[i].value) <br>} <br></script> <br> </div> <br><strong>js 트래버스 json 배열</strong> <br><div class="htmlarea"> <textarea id="runcode49950"> <title> 새 문서 </title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <form name="form"> <a href="#" onclick="e();"> </a>클릭<input name="txtName" value="" type="text" size="50"> </form> </textarea> <br><input onclick="runEx('runcode49950')" type="button" value="运行代码"><input onclick="doCopy('runcode49950')" type="button" value="复制代码"> <input onclick="doSave(runcode49950)" type="button" value="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">[Ctrl A 모두 선택 참고: </a>외부 J를 도입해야 하는 경우 실행하려면 새로 고쳐야 합니다 </div>]<script language="javascript"> function e() { var json=[{"kl_id":"2","kl_title":"Test date","kl_content":"Test date","kl_type":"1","id":"1"},{"kl_id":"2","kl_title":"Test","kl_content":"Test","kl_type":"1","id":"2"}] var str = ""; for (var one in json) { for(var key in json[one]) { str += json[one][key] + ","; } } document.form.txtName.value = str; } </script>