--用json的时候,知道id获取对应的name或者相反根据name获取id --内核代码 <script> var products=[{ID:1,Name:"a",Price:1},{ID:2,Name:"b",Price:4}]; for(var s in products) { alert("ID是:"+products[s].ID+"Name是:"+products[s].Name); } </sc
<div id="tests" class="a b c" style="color:#f00">123</div> var test = tests.firstChild.nodeValue; tests = tests.childNodes[0]; tests.insertData(0,789);//从前插入789 var t2 = document.querySelector("#tests");