在IE9上加载图像后的事件 [英] The event after loading image on IE9
问题描述
我正在写一个互联网网站,使用javascript, IE9 的HTML。
I am writing an internet site, using javascript, HTML for IE9.
我找到了通过以下方式动态加载图片的解决方案: / p>
I found solution to loading dynamically the image by:
document.getElementById("id_image").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = document.getElementById("id_filepic").value
与< IMG>相关的id_image
和id_filepic与相关< input id =id_filepictype =file>
id_image related to the <IMG>
and id_filepic related to <input id="id_filepic" type="file">
行之后:
document.getElementById("id_image").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = document.getElementById("id_filepic").value
什么是在html页面上显示图像之后发生的确切事件(因此,图像具有宽度+高度),以及如何捕获该事件?
what is the exact event that occurs just after the image is shown on the html page (hence, the image has width + height), and how can I capture that event?
了解IE9的解决方案对我很重要。
推荐答案
它不一定要在那一行之后,因为它无论如何都是异步的,但它是:
It doesn't have to be after that line, since it will be asynchronous anyway, but here it is:
document.getElementById("id_image").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = document.getElementById("id_filepic").value;
document.getElementById("id_image").addEventListener('load', (function(i) {
return function() {
console.log(i, 'loaded');
}, false);
})(i));
资料来源: Javascript Image onload事件绑定
这篇关于在IE9上加载图像后的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!