(转)Jquery .each()循环

<!DOCTYPE html>
<html xmlns="http://www.w3.org/xhtml/1999">
	<head>
		<script type="text/javascript" src="jquery-1.6.4.js"></script>
		<script type="text/javascript">
			var a = ['aaaa','bbbb','cccc'];
			$.each(a,function(i,val){
				alert(  typeof(a)+"---> "+i+" : "+typeof(val)+" : "+val);
			});
		</script>
	</head>
		
	<body>
	</body>

</html> 

 

js:

var a = ['aaaa','bbbb','cccc']; // 数组
$.each(a,function(i,val){ //迭代
        //  i  ---> 下标
        //  val ---> a[i] 
	alert(  typeof(a)+"---> "+i+" : "+typeof(val)+" : "+val);
});

 


版权声明:本文为mazhen20073492原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。