概要
document.designMode
控制整個文件是否能夠編輯。可用的數值是 "on"
和 "off"
。根據規範,這個屬性預設值為 "off"
。Firefox 遵從這個標準。較早以前的 Chrome 和 IE 預設值是 "inherit"
。從 Chrome 43 起,預設值是 「off
」;不再支援「inherit
」。在 IE6-10 中,數值為大寫英文字母。
語法
var mode = document.designMode;
document.designMode = "on";
document.designMode = "off";
範例
讓 <iframe>
的文件可以給使用者編輯:
iframeNode.contentDocument.designMode = "on";
規範
規範 | 狀態 | 註解 |
---|---|---|
HTML Living Standard The definition of 'designMode' in that specification. |
Living Standard | Initial definition. |
瀏覽器相容性
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
功能 | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
基本支援 | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
功能 | Android | Android Webview | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
基本支援 | No support | (Yes) | ? | ? | ? | ? | ? | (Yes) |