aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/xmldocument/load
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/xmldocument/load
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/xmldocument/load')
-rw-r--r--files/zh-cn/web/api/xmldocument/load/index.html35
1 files changed, 35 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/xmldocument/load/index.html b/files/zh-cn/web/api/xmldocument/load/index.html
new file mode 100644
index 0000000000..2ba7774606
--- /dev/null
+++ b/files/zh-cn/web/api/xmldocument/load/index.html
@@ -0,0 +1,35 @@
+---
+title: XMLDocument.load()
+slug: Web/API/XMLDocument/load
+translation_of: Web/API/XMLDocument/load
+---
+<p>{{APIRef("DOM")}}</p>
+
+<p><code>document.load()</code>作为旧版的w3c标准 <a class="external" href="http://www.w3.org/TR/2003/WD-DOM-Level-3-LS-20030619/load-save.html#LS-DocumentLS">DOM Level 3 Load &amp; Save module</a> 其中的一部分. <a href="/zh-cn/DOM/document.async" title="zh-cn/DOM/document.async">document.async</a> 用来表明该请求是以同步模式进行还是异步模式进行(默认值). 从 Gecko 1.9开始 ,该方法不支持跨站的文档请求.(使用 <a href="/zh-cn/DOM/XMLHttpRequest" title="zh-cn/XMLHttpRequest">XMLHttpRequest</a> 代替).</p>
+
+<h3 id="代码示例">代码示例</h3>
+
+<pre>var xmlDoc = document.implementation.createDocument("", "test", null);
+function documentLoaded (e) {
+ alert(new XMLSerializer().serializeToString(e.target)); // 返回一个包含querydata.xml内容的字符串.
+}
+xmlDoc.addEventListener("load", documentLoaded, false);
+xmlDoc.load('querydata.xml');
+</pre>
+
+<p>在XML/tests目录下{{ Source("content/xml/tests/load/", "查看load示例") }} . (在LXR生成的页面内加载load.html文件是无效的,因为LXR会将test.xml合并到load.html中作为一个单独的HTML页面返回. 为了测试这个功能,你可以在自己的本地磁盘或网络服务器上创建测试文件.)</p>
+
+<h3 id="相关链接">相关链接</h3>
+
+<ul>
+ <li><a href="/zh-cn/DOM/document.async" title="zh-cn/DOM/document.async">document.async</a></li>
+ <li><a href="/zh-cn/XML_in_Mozilla" title="zh-cn/XML_in_Mozilla">XML in Mozilla</a></li>
+</ul>
+
+<h3 id="规范">规范</h3>
+
+<ul>
+ <li><a class="external" href="http://www.w3.org/TR/2003/WD-DOM-Level-3-LS-20030619/load-save.html#LS-DocumentLS">Old W3C Working Draft of the DOM Level 3 Load &amp; Save module</a></li>
+</ul>
+
+<p>{{ languages( {"en": "en/DOM/document.load" } ) }}</p>