aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/conflicting/web/api/xmlhttprequest/loadstart_event/index.html
blob: 924d3f94d9adb9e9dfca1609ec252e3bb55c25bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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>