Image 对象事件

以前没怎么注意image上的事件

Image 对象事件

事件描述W3C
onabort 当用户放弃图像的装载时调用的事件句柄。 Yes
onerror 在装载图像的过程中发生错误时调用的事件句柄。 Yes
onload 当图像装载完毕时调用的事件句柄。 Yes
<html>
    <head>
    <script>
        function loadImage() {
                alert("图片加载完成");
            }
        </script>
    </head>

    <body>
        <img src="w3javascript.gif" onload="loadImage()">
    </body>
</html>        

https://www.runoob.com/jsref/dom-obj-image.html

https://www.runoob.com/jsref/event-img-onload.html

原文地址:https://www.cnblogs.com/taohuaya/p/10943595.html