在IE中加载图像事件

时间:2012-10-10 10:10:26

标签: javascript jquery

我正在动态创建图像标签,并且在图像的加载事件中,我想要图像的高度和宽度。

I have following code


 var foreImage = $('<img/>')
.load(function () {
    alert( this.height + '  ' +  this.width );
}).attr("src", imageUrl);

上面的代码适用于firefox和chrome,但在IE 8中它失败了。 知道为什么吗?

0 个答案:

没有答案
相关问题