要获取图片上传后的宽度高度,可以使用
img.onload=function(){ var baseWidth = this.width; $("#"+id).width(baseWidth);}jq写法$('img').load(function(){ var baseWidth = this.width; $("#"+id).width(baseWidth);
})