Image 对象事件

之前没怎么注意image上的事件javascript

 

Image 对象事件html

事件 描述 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.htmljava

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

相关文章
相关标签/搜索