JavaScript中的遍历
for 遍历
var anArray = ['one','two']; for(var n = 0; n < anArray.length; n++) { //具体代码 }
for(var p in anObject)遍历
var anObject = {one: 1, two: 2}; for(var p in anObject) { //具体代码 }
Jquery遍历
$.each遍历
//数组遍历 var anArray = ['one','two']; $.each(anArray, funtion(n, value) { alert(n); alert(value); } ) //对象遍历 var anObject = {one: 1, two: 2}; $.each(anObjct, function(name,value) { alert(name); alert(value); } )