diff options
Diffstat (limited to 'files/zh-cn/web/api/xmldocument/async')
-rw-r--r-- | files/zh-cn/web/api/xmldocument/async/index.html | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/xmldocument/async/index.html b/files/zh-cn/web/api/xmldocument/async/index.html new file mode 100644 index 0000000000..f1e29dee9d --- /dev/null +++ b/files/zh-cn/web/api/xmldocument/async/index.html @@ -0,0 +1,30 @@ +--- +title: XMLDocument.async +slug: Web/API/XMLDocument/async +translation_of: Web/API/XMLDocument/async +--- +<p>{{APIRef("DOM")}}{{Non-standard_header}}{{Deprecated_header}}</p> + +<p><code>document.async</code> 可以被赋值,用来表明 <code><a href="/zh-cn/DOM/document.load" title="zh-cn/DOM/document.load">document.load</a></code> 被调用时,是使用异步模式还是同步模式进行请求. <code>true</code> 为默认值, 表明该文档应该被异步加载.</p> + +<p>(从Gecko 1.4alpha 开始,文档请求可以以异步模式进行,在这之前,只有同步模式可用.)</p> + +<h2 id="Code_example" name="Code_example">代码示例</h2> + +<pre>function loadXMLData(e) +{ +alert(new XMLSerializer().serializeToString(e.target)); // 返回一个包含querydata.xml内容的字符串. +} + +var xmlDoc = document.implementation.createDocument("", "test", null); +xmlDoc.async = false; +xmlDoc.onload = loadXMLData; +xmlDoc.load('querydata.xml'); +</pre> + +<h2 id="See_also" name="See_also">相关链接</h2> + +<ul> + <li><a href="/zh-cn/XML_in_Mozilla" title="zh-cn/XML_in_Mozilla">XML in Mozilla</a></li> + <li>{{DOMxRef("XMLDocument.load()")}}</li> +</ul> |