你把这个对象定义到全局中,比如这么写
var arrPic = {}//定义一个空数组保存初始的长与宽
$(".p_Lst").each(function(index) {
var $this = $(this)//获取每个外框Div
var $img = $this.find("img")//查找其中的图片元素
var $info = $this.find(".p_Alt")//查询其中的图片信息元素
arrPic.imgw = $img.width()
arrPic.imgh = $img.height()
arrPic.orgw = $this.width()
arrPic.orgh = $this.height()
},
让后你把arrPic打印出来,你这样去试一下,应该没什么问题
var arr = new Array()for(var i in data){
arr.push(data[0])
if(data[i+1] ==判断条件){
arr.push(data[i+1])
}
}