aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/document/designmode/index.html
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/document/designmode/index.html
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/document/designmode/index.html')
-rw-r--r--files/zh-cn/web/api/document/designmode/index.html58
1 files changed, 58 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/document/designmode/index.html b/files/zh-cn/web/api/document/designmode/index.html
new file mode 100644
index 0000000000..feb7070b19
--- /dev/null
+++ b/files/zh-cn/web/api/document/designmode/index.html
@@ -0,0 +1,58 @@
+---
+title: Document.designMode
+slug: Web/API/Document/designMode
+tags:
+ - API
+ - Document
+ - Property
+ - Reference
+ - 参考
+ - 属性
+ - 文档
+ - 编辑
+translation_of: Web/API/Document/designMode
+---
+<div>{{ ApiRef()}}</div>
+
+<p><strong><code>document.designMode</code></strong> 控制整个文档是否可编辑。有效值为 <code>"on"</code> 和 <code>"off"</code> 。根据规范,该属性默认为 <code>"off"</code> 。Firefox 遵循此标准。早期版本的 Chrome 和 IE默认为 <code>"inherit"</code> 。从 Chrome 43 开始,默认值为 <code>"off"</code> ,并且不再支持  <code>"inherit"</code>。在 IE6 到 IE10 中,该值为大写。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">var mode = document.designMode;
+document.designMode = "on" || "off";</pre>
+
+<h2 id="示例">示例</h2>
+
+<p>使一个 {{HTMLElement("iframe")}} 的文档可编辑:</p>
+
+<pre class="brush: js">iframeNode.contentDocument.designMode = "on";</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('HTML WHATWG', '#making-entire-documents-editable:-the-designmode-idl-attribute', 'designMode')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("api.Document.designMode")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li><a href="/zh-CN/docs/Rich-Text_Editing_in_Mozilla">Mozilla 软件中的富文本编辑</a></li>
+ <li>{{domxref("HTMLElement.contentEditable")}}</li>
+</ul>