当前位置 : 主页 > 网络编程 > JavaScript >

$.each遍历对象、数组的属性值

来源:互联网 收集:自由互联 发布时间:2021-07-03
1. [代码] [JavaScript]代码 var jsonAry1 = {"x":"xxx","y":"yyy"};var jsonAry2 = {"x":{"xx":"xxx","yy":"yyy"}}$.each(jsonAry2,function(index,content){alert(index+":"+content.xx+":"+content["yy"]);})

1. [代码][JavaScript]代码    

var jsonAry1 = {"x":"xxx","y":"yyy"};
var jsonAry2 = {"x":{"xx":"xxx","yy":"yyy"}}

$.each(jsonAry2,function(index,content){
	alert(index+":"+content.xx+":"+content["yy"]);
})
网友评论