From 4873c5f1122ac800cf3c916a52df07e05ddc9dcf Mon Sep 17 00:00:00 2001 From: MDN Date: Fri, 11 Feb 2022 00:58:37 +0000 Subject: [CRON] sync translated content --- .../web/api/animation/cancel_event/index.html | 112 +++++++++++++++++++ files/zh-cn/web/api/animation/oncancel/index.html | 111 ------------------- .../xmlhttprequest/onreadystatechange/index.html | 120 -------------------- .../readystatechange_event/index.html | 121 +++++++++++++++++++++ .../xmlhttprequesteventtarget/onabort/index.html | 56 ---------- .../xmlhttprequesteventtarget/onerror/index.html | 60 ---------- .../xmlhttprequesteventtarget/onload/index.html | 54 --------- .../onloadstart/index.html | 54 --------- .../onprogress/index.html | 64 ----------- 9 files changed, 233 insertions(+), 519 deletions(-) create mode 100644 files/zh-cn/web/api/animation/cancel_event/index.html delete mode 100644 files/zh-cn/web/api/animation/oncancel/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequest/onreadystatechange/index.html create mode 100644 files/zh-cn/web/api/xmlhttprequest/readystatechange_event/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequesteventtarget/onabort/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequesteventtarget/onerror/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequesteventtarget/onload/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequesteventtarget/onloadstart/index.html delete mode 100644 files/zh-cn/web/api/xmlhttprequesteventtarget/onprogress/index.html (limited to 'files/zh-cn/web/api') diff --git a/files/zh-cn/web/api/animation/cancel_event/index.html b/files/zh-cn/web/api/animation/cancel_event/index.html new file mode 100644 index 0000000000..339ac7e40f --- /dev/null +++ b/files/zh-cn/web/api/animation/cancel_event/index.html @@ -0,0 +1,112 @@ +--- +title: Animation.oncancel +slug: Web/API/Animation/cancel_event +tags: + - API + - Animation +translation_of: Web/API/Animation/oncancel +original_slug: Web/API/Animation/oncancel +--- +

{{ SeeCompatTable() }}{{ APIRef("Web Animations") }}

+ +

Web Animations API 的 {{domxref("Animation")}} 接口的 oncancel 属性是 {{event("cancel")}} 事件的事件处理程序。

+ +

当动作从其他状态进入 "idle" 播放状态,例如当动画在结束播放后从元素中移除时,cancel 事件可以 {{domxref("Animation.cancel()")}} 被手动触发。 

+ +
+

在新的动画中,创建一个新的初始的空闲动画不会触发 {{event("cancel")}} 事件。

+
+ +

语法

+ +
var cancelHandler = Animation.oncancel;
+
+Animation.oncancel = cancelHandler;
+ +

+ +

当动画被取消时,这个函数将会被执行。默认是 null 。

+ +

例子

+ +

如果动画被取消,将会从元素中移除它。

+ +
animation.oncancel = animation.effect.target.remove();
+
+ +

标准

+ + + + + + + + + + + + + + +
标准状态备注
{{SpecName('Web Animations', '#dom-animation-oncancel', 'Animation.oncancel' )}}{{Spec2('Web Animations')}}编辑草案中。
+ +

浏览器兼容性

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
功能ChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
基础支持{{CompatChrome(39.0)}}{{CompatGeckoDesktop(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
功能AndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
基础支持{{CompatVersionUnknown}}{{CompatGeckoMobile(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +

[1] Web Animations API 默认在 Firefox Developer Edition 和 Nightly builds 被启用。你可以在设置属性 dom.animations-api.core.enabled 为 true 时在 Beta 和 发行版 开启这个功能,你可以设置为 false 来禁用这个功能。

+ +

参见

+ + diff --git a/files/zh-cn/web/api/animation/oncancel/index.html b/files/zh-cn/web/api/animation/oncancel/index.html deleted file mode 100644 index 00e9b0fc98..0000000000 --- a/files/zh-cn/web/api/animation/oncancel/index.html +++ /dev/null @@ -1,111 +0,0 @@ ---- -title: Animation.oncancel -slug: Web/API/Animation/oncancel -tags: - - API - - Animation -translation_of: Web/API/Animation/oncancel ---- -

{{ SeeCompatTable() }}{{ APIRef("Web Animations") }}

- -

Web Animations API 的 {{domxref("Animation")}} 接口的 oncancel 属性是 {{event("cancel")}} 事件的事件处理程序。

- -

当动作从其他状态进入 "idle" 播放状态,例如当动画在结束播放后从元素中移除时,cancel 事件可以 {{domxref("Animation.cancel()")}} 被手动触发。 

- -
-

在新的动画中,创建一个新的初始的空闲动画不会触发 {{event("cancel")}} 事件。

-
- -

语法

- -
var cancelHandler = Animation.oncancel;
-
-Animation.oncancel = cancelHandler;
- -

- -

当动画被取消时,这个函数将会被执行。默认是 null 。

- -

例子

- -

如果动画被取消,将会从元素中移除它。

- -
animation.oncancel = animation.effect.target.remove();
-
- -

标准

- - - - - - - - - - - - - - -
标准状态备注
{{SpecName('Web Animations', '#dom-animation-oncancel', 'Animation.oncancel' )}}{{Spec2('Web Animations')}}编辑草案中。
- -

浏览器兼容性

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
功能ChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
基础支持{{CompatChrome(39.0)}}{{CompatGeckoDesktop(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - -
功能AndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
基础支持{{CompatVersionUnknown}}{{CompatGeckoMobile(48)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -

[1] Web Animations API 默认在 Firefox Developer Edition 和 Nightly builds 被启用。你可以在设置属性 dom.animations-api.core.enabled 为 true 时在 Beta 和 发行版 开启这个功能,你可以设置为 false 来禁用这个功能。

- -

参见

- - diff --git a/files/zh-cn/web/api/xmlhttprequest/onreadystatechange/index.html b/files/zh-cn/web/api/xmlhttprequest/onreadystatechange/index.html deleted file mode 100644 index 76bd8c6ccf..0000000000 --- a/files/zh-cn/web/api/xmlhttprequest/onreadystatechange/index.html +++ /dev/null @@ -1,120 +0,0 @@ ---- -title: XMLHttpRequest.onreadystatechange -slug: Web/API/XMLHttpRequest/onreadystatechange -tags: - - XHR - - XMLHttpRequest - - 参考 - - 处理程序 - - 属性 - - 接口 -translation_of: Web/API/XMLHttpRequest/onreadystatechange ---- -
{{APIRef}}
- -

只要 readyState 属性发生变化,就会调用相应的处理函数这个回调函数会被用户线程所调用。XMLHttpRequest.onreadystatechange 会在 {{domxref("XMLHttpRequest")}} 的{{domxref("XMLHttpRequest.readyState", "readyState")}} 属性发生改变时触发 {{event("readystatechange")}} 事件的时候被调用。

- -
-

警告:这个方法不该用于同步的requests对象,并且不能在内部(C++)代码中使用.

-
- -

当一个 XMLHttpRequest 请求被 abort() 方法取消时,其对应的 readystatechange 事件不会被触发。

- -
-

UPDATE: 在下面的浏览器版本中会触发 (Firefox 51.0.1, Opera 43.0.2442.991, Safari 10.0.3 (12602.4.8), Chrome 54.0.2840.71, Edge, IE11). 例子在 here - 重新加载几次页面即可。

-
- -

语法

- -
XMLHttpRequest.onreadystatechange = callback;
- -

取值

- - - -

示例

- -
var xhr= new XMLHttpRequest(),
-    method = "GET",
-    url = "https://developer.mozilla.org/";
-
-xhr.open(method, url, true);
-xhr.onreadystatechange = function () {
-  if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
-    console.log(xhr.responseText)
-  }
-}
-xhr.send();
- -

规范

- - - - - - - - - - - - - - -
规范状态注释
{{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

浏览器兼容性

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(1)}}{{CompatGeckoDesktop(1.0)}}{{CompatIe(7)}}[1]{{CompatVersionUnknown}}{{CompatSafari(1.2)}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}1.0{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
- -

[1] IE 5 和 6可以通过使用 ActiveXObject() 支持ajax。

diff --git a/files/zh-cn/web/api/xmlhttprequest/readystatechange_event/index.html b/files/zh-cn/web/api/xmlhttprequest/readystatechange_event/index.html new file mode 100644 index 0000000000..63cdfe5bf8 --- /dev/null +++ b/files/zh-cn/web/api/xmlhttprequest/readystatechange_event/index.html @@ -0,0 +1,121 @@ +--- +title: XMLHttpRequest.onreadystatechange +slug: Web/API/XMLHttpRequest/readystatechange_event +tags: + - XHR + - XMLHttpRequest + - 参考 + - 处理程序 + - 属性 + - 接口 +translation_of: Web/API/XMLHttpRequest/onreadystatechange +original_slug: Web/API/XMLHttpRequest/onreadystatechange +--- +
{{APIRef}}
+ +

只要 readyState 属性发生变化,就会调用相应的处理函数这个回调函数会被用户线程所调用。XMLHttpRequest.onreadystatechange 会在 {{domxref("XMLHttpRequest")}} 的{{domxref("XMLHttpRequest.readyState", "readyState")}} 属性发生改变时触发 {{event("readystatechange")}} 事件的时候被调用。

+ +
+

警告:这个方法不该用于同步的requests对象,并且不能在内部(C++)代码中使用.

+
+ +

当一个 XMLHttpRequest 请求被 abort() 方法取消时,其对应的 readystatechange 事件不会被触发。

+ +
+

UPDATE: 在下面的浏览器版本中会触发 (Firefox 51.0.1, Opera 43.0.2442.991, Safari 10.0.3 (12602.4.8), Chrome 54.0.2840.71, Edge, IE11). 例子在 here - 重新加载几次页面即可。

+
+ +

语法

+ +
XMLHttpRequest.onreadystatechange = callback;
+ +

取值

+ + + +

示例

+ +
var xhr= new XMLHttpRequest(),
+    method = "GET",
+    url = "https://developer.mozilla.org/";
+
+xhr.open(method, url, true);
+xhr.onreadystatechange = function () {
+  if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
+    console.log(xhr.responseText)
+  }
+}
+xhr.send();
+ +

规范

+ + + + + + + + + + + + + + +
规范状态注释
{{SpecName('XMLHttpRequest', '#handler-xhr-onreadystatechange')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

浏览器兼容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(1)}}{{CompatGeckoDesktop(1.0)}}{{CompatIe(7)}}[1]{{CompatVersionUnknown}}{{CompatSafari(1.2)}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}1.0{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

[1] IE 5 和 6可以通过使用 ActiveXObject() 支持ajax。

diff --git a/files/zh-cn/web/api/xmlhttprequesteventtarget/onabort/index.html b/files/zh-cn/web/api/xmlhttprequesteventtarget/onabort/index.html deleted file mode 100644 index 38d305c1c2..0000000000 --- a/files/zh-cn/web/api/xmlhttprequesteventtarget/onabort/index.html +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onabort -slug: Web/API/XMLHttpRequestEventTarget/onabort -translation_of: Web/API/XMLHttpRequestEventTarget/onabort ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onabort 会在 {{domxref("XMLHttpRequest")}} 交易操作被诸如 {{domxref("XMLHttpRequest.abort()")}} 函数中止时调用。

- -

语法

- -
XMLHttpRequest.onabort = callback;
- -

- - - -

示例

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onabort = function () {
-  console.log('** 请求被中止');
-};
-xmlhttp.send();
-//..
-xmlhttp.abort(); // 这将会调用我们上面定义的 onabort 回调函数
-
- -

规范

- - - - - - - - - - - - - - -
规范状态备注
{{SpecName('XMLHttpRequest', '#handler-xhr-onabort')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

浏览器兼容性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onabort")}}

diff --git a/files/zh-cn/web/api/xmlhttprequesteventtarget/onerror/index.html b/files/zh-cn/web/api/xmlhttprequesteventtarget/onerror/index.html deleted file mode 100644 index 3c604e5026..0000000000 --- a/files/zh-cn/web/api/xmlhttprequesteventtarget/onerror/index.html +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onerror -slug: Web/API/XMLHttpRequestEventTarget/onerror -tags: - - API - - Event Handler - - XMLHttpRequestEventTarget -translation_of: Web/API/XMLHttpRequestEventTarget/onerror ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onerror 是{{domxref("XMLHttpRequest")}} 事务由于错误而失败时调用的函数。

- -

请注意只有在网络层级出现错误时才会调用此函数。如果错误只出现在应用层(比如发送一个HTTP的错误码),这个方法将不会被调用。

- -

语法

- -
XMLHttpRequest.onerror = callback;
- -

Values

- - - -

举例

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onerror = function () {
-  console.log("** An error occurred during the transaction");
-};
-xmlhttp.send();
-
- -

规范

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onerror')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

浏览器兼容性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onerror")}}

diff --git a/files/zh-cn/web/api/xmlhttprequesteventtarget/onload/index.html b/files/zh-cn/web/api/xmlhttprequesteventtarget/onload/index.html deleted file mode 100644 index 8e2c27016f..0000000000 --- a/files/zh-cn/web/api/xmlhttprequesteventtarget/onload/index.html +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onload -slug: Web/API/XMLHttpRequestEventTarget/onload -translation_of: Web/API/XMLHttpRequestEventTarget/onload ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onload 是 {{domxref("XMLHttpRequest")}} 请求成功完成时调用的函数。

- -

语法

- -
XMLHttpRequest.onload = callback;
- -

- - - -

示例

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onload = function () {
-  // 处理取回的数据(在 xmlhttp.response 中找到)
-};
-xmlhttp.send();
-
- -

规范

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

浏览器兼容性

- - - -

{{Compat("api.XMLHttpRequestEventTarget.onload")}}

diff --git a/files/zh-cn/web/api/xmlhttprequesteventtarget/onloadstart/index.html b/files/zh-cn/web/api/xmlhttprequesteventtarget/onloadstart/index.html deleted file mode 100644 index 1501afd132..0000000000 --- a/files/zh-cn/web/api/xmlhttprequesteventtarget/onloadstart/index.html +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onloadstart -slug: Web/API/XMLHttpRequestEventTarget/onloadstart -translation_of: Web/API/XMLHttpRequestEventTarget/onloadstart ---- -
{{APIRef("XMLHttpRequest")}}
- -

XMLHttpRequestEventTarget.onloadstart 在{{domxref("XMLHttpRequest")}} 开始传送数据时被调用

- -

语法

- -
XMLHttpRequest.onloadstart = callback;
- -

- - - -

示例

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onloadstart = function () {
-  console.log("Download underway");
-};
-xmlhttp.send();
-
- -

规范

- - - - - - - - - - - - - - -
规范状态说明
{{SpecName('XMLHttpRequest', '#handler-xhr-onloadstart')}}{{Spec2('XMLHttpRequest')}}WHATWG 现存标准
- -

浏览器兼容性

- - - -

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

diff --git a/files/zh-cn/web/api/xmlhttprequesteventtarget/onprogress/index.html b/files/zh-cn/web/api/xmlhttprequesteventtarget/onprogress/index.html deleted file mode 100644 index 40641b30a6..0000000000 --- a/files/zh-cn/web/api/xmlhttprequesteventtarget/onprogress/index.html +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: XMLHttpRequestEventTarget.onprogress -slug: Web/API/XMLHttpRequestEventTarget/onprogress -translation_of: Web/API/XMLHttpRequestEventTarget/onprogress ---- -

{{APIRef("XMLHttpRequest")}}

- -

XMLHttpRequestEventTarget.onprogress 是在 {{domxref("XMLHttpRequest")}} 完成之前周期性调用的函数。

- -

语法

- -
XMLHttpRequest.onprogress = callback;
- -

- - - -

事件

- - - -
XMLHttpRequest.onprogress = function (event) {
-  event.loaded;
-  event.total;
-};
- -

示例

- -
var xmlhttp = new XMLHttpRequest(),
-  method = 'GET',
-  url = 'https://developer.mozilla.org/';
-
-xmlhttp.open(method, url, true);
-xmlhttp.onprogress = function () {
-  //do something
-};
-xmlhttp.send();
-
- -

规范

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
- -

浏览器兼容性

- -

{{Compat("api.XMLHttpRequestEventTarget.onprogress")}}

-- cgit v1.2.3-54-g00ecf