blob: 0f9db1b169a16f2766d8c434a5f28f7438f7842d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
---
title: GlobalEventHandlers.onloadend
slug: Web/API/GlobalEventHandlers/onloadend
translation_of: Web/API/GlobalEventHandlers/onloadend
---
<div>{{ApiRef}}</div>
<div>{{domxref("GlobalEventHandlers")}}的<strong><code>onloadend</code></strong> 属性是用来 表示触发{{event("loadend")}}事件时(资源加载进度停止时)的{{domxref("EventHandler")}}。</div>
<h2 id="语法">语法</h2>
<pre class="syntaxbox notranslate"><var>img</var>.onloadend = <var>funcRef</var>;
</pre>
<h3 id="Value">Value</h3>
<p><code>funcRef是在事件源的loadend事件触发时要调用的处理函数。</code></p>
<h2 id="范例">范例</h2>
<h3 id="HTML_content">HTML content</h3>
<pre class="brush: html notranslate"><img src="myImage.jpg"></pre>
<h3 id="JavaScript_content">JavaScript content</h3>
<pre class="brush: js notranslate">// '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');
});</pre>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<div>
<p>{{Compat("api.GlobalEventHandlers.onloadend")}}</p>
</div>
|