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/xmlhttprequest/abort_event/index.html | 57 +++++++++++++++++++ .../web/api/xmlhttprequest/error_event/index.html | 61 ++++++++++++++++++++ .../web/api/xmlhttprequest/load_event/index.html | 55 ++++++++++++++++++ .../api/xmlhttprequest/loadstart_event/index.html | 55 ++++++++++++++++++ .../api/xmlhttprequest/progress_event/index.html | 65 ++++++++++++++++++++++ 5 files changed, 293 insertions(+) create mode 100644 files/zh-cn/conflicting/web/api/xmlhttprequest/abort_event/index.html create mode 100644 files/zh-cn/conflicting/web/api/xmlhttprequest/error_event/index.html create mode 100644 files/zh-cn/conflicting/web/api/xmlhttprequest/load_event/index.html create mode 100644 files/zh-cn/conflicting/web/api/xmlhttprequest/loadstart_event/index.html create mode 100644 files/zh-cn/conflicting/web/api/xmlhttprequest/progress_event/index.html (limited to 'files/zh-cn/conflicting/web/api/xmlhttprequest') diff --git a/files/zh-cn/conflicting/web/api/xmlhttprequest/abort_event/index.html b/files/zh-cn/conflicting/web/api/xmlhttprequest/abort_event/index.html new file mode 100644 index 0000000000..289050d88b --- /dev/null +++ b/files/zh-cn/conflicting/web/api/xmlhttprequest/abort_event/index.html @@ -0,0 +1,57 @@ +--- +title: XMLHttpRequestEventTarget.onabort +slug: conflicting/Web/API/XMLHttpRequest/abort_event +translation_of: Web/API/XMLHttpRequestEventTarget/onabort +original_slug: 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/conflicting/web/api/xmlhttprequest/error_event/index.html b/files/zh-cn/conflicting/web/api/xmlhttprequest/error_event/index.html new file mode 100644 index 0000000000..2de18d0333 --- /dev/null +++ b/files/zh-cn/conflicting/web/api/xmlhttprequest/error_event/index.html @@ -0,0 +1,61 @@ +--- +title: XMLHttpRequestEventTarget.onerror +slug: conflicting/Web/API/XMLHttpRequest/error_event +tags: + - API + - Event Handler + - XMLHttpRequestEventTarget +translation_of: Web/API/XMLHttpRequestEventTarget/onerror +original_slug: 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/conflicting/web/api/xmlhttprequest/load_event/index.html b/files/zh-cn/conflicting/web/api/xmlhttprequest/load_event/index.html new file mode 100644 index 0000000000..f4f1214644 --- /dev/null +++ b/files/zh-cn/conflicting/web/api/xmlhttprequest/load_event/index.html @@ -0,0 +1,55 @@ +--- +title: XMLHttpRequestEventTarget.onload +slug: conflicting/Web/API/XMLHttpRequest/load_event +translation_of: Web/API/XMLHttpRequestEventTarget/onload +original_slug: 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/conflicting/web/api/xmlhttprequest/loadstart_event/index.html b/files/zh-cn/conflicting/web/api/xmlhttprequest/loadstart_event/index.html new file mode 100644 index 0000000000..924d3f94d9 --- /dev/null +++ b/files/zh-cn/conflicting/web/api/xmlhttprequest/loadstart_event/index.html @@ -0,0 +1,55 @@ +--- +title: XMLHttpRequestEventTarget.onloadstart +slug: conflicting/Web/API/XMLHttpRequest/loadstart_event +translation_of: Web/API/XMLHttpRequestEventTarget/onloadstart +original_slug: 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/conflicting/web/api/xmlhttprequest/progress_event/index.html b/files/zh-cn/conflicting/web/api/xmlhttprequest/progress_event/index.html new file mode 100644 index 0000000000..3640fb9cd9 --- /dev/null +++ b/files/zh-cn/conflicting/web/api/xmlhttprequest/progress_event/index.html @@ -0,0 +1,65 @@ +--- +title: XMLHttpRequestEventTarget.onprogress +slug: conflicting/Web/API/XMLHttpRequest/progress_event +translation_of: Web/API/XMLHttpRequestEventTarget/onprogress +original_slug: 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