diff options
Diffstat (limited to 'files/zh-cn/conflicting/web/api')
5 files changed, 293 insertions, 0 deletions
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 +--- +<div>{{APIRef("XMLHttpRequest")}}</div> + +<p><strong><code>XMLHttpRequestEventTarget.onabort</code></strong> 会在 {{domxref("XMLHttpRequest")}} 交易操作被诸如 {{domxref("XMLHttpRequest.abort()")}} 函数中止时调用。</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox"><em>XMLHttpRequest</em>.onabort = <em>callback</em>;</pre> + +<h3 id="值">值</h3> + +<ul> + <li><code><em>callback</em></code> 在交易被中止时调用的函数。</li> +</ul> + +<h2 id="Example" name="Example">示例</h2> + +<pre class="brush: js">var xmlhttp = new XMLHttpRequest(), + method = 'GET', + url = 'https://developer.mozilla.org/'; + +xmlhttp.open(<em>method</em>, <em>url</em>, true); +xmlhttp.onabort = function () { + console.log('** 请求被中止'); +}; +xmlhttp.send(); +//.. +xmlhttp.abort(); // 这将会调用我们上面定义的 onabort 回调函数 +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">备注</th> + </tr> + <tr> + <td>{{SpecName('XMLHttpRequest', '#handler-xhr-onabort')}}</td> + <td>{{Spec2('XMLHttpRequest')}}</td> + <td>WHATWG living standard</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.XMLHttpRequestEventTarget.onabort")}}</p> 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 +--- +<div>{{APIRef("XMLHttpRequest")}}</div> + +<p><strong><code>XMLHttpRequestEventTarget.onerror</code></strong> 是{{domxref("XMLHttpRequest")}} 事务由于错误而失败时调用的函数。</p> + +<p>请注意只有在网络层级出现错误时才会调用此函数。如果错误只出现在应用层(比如发送一个HTTP的错误码),这个方法将不会被调用。</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox"><em>XMLHttpRequest</em>.onerror = <em>callback</em>;</pre> + +<h3 id="Values">Values</h3> + +<ul> + <li><code><em>callback</em></code> 是当请求失败时执行的函数。</li> +</ul> + +<h2 id="Example" name="Example">举例</h2> + +<pre class="brush: js">var xmlhttp = new XMLHttpRequest(), + method = 'GET', + url = 'https://developer.mozilla.org/'; + +xmlhttp.open(<em>method</em>, <em>url</em>, true); +xmlhttp.onerror = function () { + console.log("** An error occurred during the transaction"); +}; +xmlhttp.send(); +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('XMLHttpRequest', '#handler-xhr-onerror')}}</td> + <td>{{Spec2('XMLHttpRequest')}}</td> + <td>WHATWG living standard</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.XMLHttpRequestEventTarget.onerror")}}</p> 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 +--- +<div>{{APIRef("XMLHttpRequest")}}</div> + +<p><strong><code>XMLHttpRequestEventTarget.onload</code></strong> 是 {{domxref("XMLHttpRequest")}} 请求成功完成时调用的函数。</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox"><em>XMLHttpRequest</em>.onload = <em>callback</em>;</pre> + +<h3 id="值">值</h3> + +<ul> + <li><code><em>callback</em></code> 是请求成功完成时要执行的函数。它接收一个 {{domxref("ProgressEvent")}} 对象作为它的第一个参数。<em>this</em> 的值(即上下文)与此回调的 {{domxref("XMLHttpRequest")}} 相同。</li> +</ul> + +<h2 id="Example" name="Example">示例</h2> + +<pre class="brush: js">var xmlhttp = new XMLHttpRequest(), + method = 'GET', + url = 'https://developer.mozilla.org/'; + +xmlhttp.open(<em>method</em>, <em>url</em>, true); +xmlhttp.onload = function () { + // 处理取回的数据(在 xmlhttp.response 中找到) +}; +xmlhttp.send(); +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}</td> + <td>{{Spec2('XMLHttpRequest')}}</td> + <td>WHATWG living standard</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.XMLHttpRequestEventTarget.onload")}}</p> 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 +--- +<div>{{APIRef("XMLHttpRequest")}}</div> + +<p><strong><code>XMLHttpRequestEventTarget.onloadstart</code></strong> 在{{domxref("XMLHttpRequest")}} 开始传送数据时被调用</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox"><em>XMLHttpRequest</em>.onloadstart = <em>callback</em>;</pre> + +<h3 id="值">值</h3> + +<ul> + <li><code><em>callback</em></code> 是开始传送数据时被调用的回调函数</li> +</ul> + +<h2 id="Example" name="Example">示例</h2> + +<pre class="brush: js">var xmlhttp = new XMLHttpRequest(), + method = 'GET', + url = 'https://developer.mozilla.org/'; + +xmlhttp.open(<em>method</em>, <em>url</em>, true); +xmlhttp.onloadstart = function () { + console.log("Download underway"); +}; +xmlhttp.send(); +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">说明</th> + </tr> + <tr> + <td>{{SpecName('XMLHttpRequest', '#handler-xhr-onloadstart')}}</td> + <td>{{Spec2('XMLHttpRequest')}}</td> + <td>WHATWG 现存标准</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.XMLHttpRequestEventTarget.onloadstart")}}</p> 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 +--- +<p>{{APIRef("XMLHttpRequest")}}</p> + +<p><strong><code>XMLHttpRequestEventTarget.onprogress</code></strong> 是在 {{domxref("XMLHttpRequest")}} 完成之前周期性调用的函数。</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre><em>XMLHttpRequest</em>.onprogress = <em>callback</em>;</pre> + +<h3 id="值">值</h3> + +<ul> + <li><code><em>callback</em></code> 在请求完成之前周期性调用的函数。</li> +</ul> + +<h3 id="Example" name="Example">事件</h3> + +<ul> + <li><em><code>event.loaded</code></em> 已传输的数据量</li> + <li><em><code>event.total</code></em> 总共的数据量</li> +</ul> + +<pre>XMLHttpRequest.onprogress = function (event) { + event.loaded; + event.total; +};</pre> + +<h2 id="Example" name="Example">示例</h2> + +<pre>var xmlhttp = new XMLHttpRequest(), + method = 'GET', + url = 'https://developer.mozilla.org/'; + +xmlhttp.open(<em>method</em>, <em>url</em>, true); +xmlhttp.onprogress = function () { + //do something +}; +xmlhttp.send(); +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('XMLHttpRequest', '#handler-xhr-onload')}}</td> + <td>{{Spec2('XMLHttpRequest')}}</td> + <td>WHATWG living standard</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{Compat("api.XMLHttpRequestEventTarget.onprogress")}}</p> |