From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../api/globaleventhandlers/onloadstart/index.html | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 files/zh-cn/web/api/globaleventhandlers/onloadstart/index.html (limited to 'files/zh-cn/web/api/globaleventhandlers/onloadstart') diff --git a/files/zh-cn/web/api/globaleventhandlers/onloadstart/index.html b/files/zh-cn/web/api/globaleventhandlers/onloadstart/index.html new file mode 100644 index 0000000000..33bfbd734a --- /dev/null +++ b/files/zh-cn/web/api/globaleventhandlers/onloadstart/index.html @@ -0,0 +1,66 @@ +--- +title: GlobalEventHandlers.onloadstart +slug: Web/API/GlobalEventHandlers/onloadstart +translation_of: Web/API/GlobalEventHandlers/onloadstart +--- +
{{ApiRef}}
+ +

TheĀ onloadstart property of the {{domxref("GlobalEventHandlers")}} mixin is an {{domxref("EventHandler")}} representing the code to be called when the {{event("loadstart")}} event is raised (when progress has begun on the loading of a resource.)

+ +

Syntax

+ +
img.onloadstart = funcRef;
+
+ +

Value

+ +

funcRef is the handler function to be called when the resource's loadstart event fires.

+ +

Examples

+ +

HTML content

+ +
<img src="myImage.jpg">
+ +

JavaScript content

+ +
// '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');
+});
+ +

Specifications

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName("HTML WHATWG", "webappapis.html#handler-onloadstart", "onloadstart")}}{{Spec2("HTML WHATWG")}}Initial definition
+ +

Browser Compatibility

+ +
+ + +

{{Compat("api.GlobalEventHandlers.onloadstart")}}

+
-- cgit v1.2.3-54-g00ecf