日期:2014-05-16 浏览次数:20392 次
<img alt="" src="http://i2.itc.cn/20130220/2d3f_a20e4149_f596_c868_3fa4_40924923debd_1.jpg" onload="imgResize(this);" id="imgid" />
function imgResize(imgObj) {
//setTimeout("", 3000);
var image = new Image();
image.src = imgObj.src;
if (image.complete) {
alert(image.complete);
}
alert(this) // window?
alert("width: " + imgObj.width + " height: " + imgObj.height);
}
function imgResize(imgObj) {
//setTimeout("", 3000);
var image = new Image();
image.src = imgObj.src;
image.onload = function(){
alert("width: " + this.width + " height: " + this.height);
}
}