diff options
Diffstat (limited to 'files/zh-cn/web/api/globaleventhandlers/onloadend/index.html')
| -rw-r--r-- | files/zh-cn/web/api/globaleventhandlers/onloadend/index.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/globaleventhandlers/onloadend/index.html b/files/zh-cn/web/api/globaleventhandlers/onloadend/index.html new file mode 100644 index 0000000000..0f9db1b169 --- /dev/null +++ b/files/zh-cn/web/api/globaleventhandlers/onloadend/index.html @@ -0,0 +1,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> |
