--- title: GlobalEventHandlers.onloadend slug: Web/API/GlobalEventHandlers/onloadend translation_of: Web/API/GlobalEventHandlers/onloadend ---
onloadend
属性是用来 表示触发{{event("loadend")}}事件时(资源加载进度停止时)的{{event("Event_handlers", "event handler")}}。img.onloadend = funcRef;
funcRef是在事件源的loadend事件触发时要调用的处理函数。
<img src="myImage.jpg">
// 'loadstart' fires first, then 'load', then 'loadend' image.addEventListener('load', function(e) { console.log('Image loaded'); }); image.addEventListener('loadstart', function(e) { console.log('Image load started'); }); image.addEventListener('loadend', function(e) { console.log('Image load finished'); });
{{Compat("api.GlobalEventHandlers.onloadend")}}