概述

document.designMode 控制整个文档是否可编辑。有效值为 “on”和 “off”。根据规范,这个属性是默认为 “off”。火狐遵循这个标准。早期版本的 Chrome和 IE默认为 "inherit"。从Chrome 43开始,默认值为"off" ,并且不再支持“inherit”。在IE6-10中,该值大写。

语法

const mode = document.designMode;
document.designMode = "on";
​document.designMode = "off";

示例

使一个 <iframe> 的文档可编辑::

iframe_node.contentDocument.designMode = "on";
 

规范

Specification Status Comment
HTML Living Standard
designMode
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!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? ? ? ?

相关链接

文档标签和贡献者

标签: 
最后编辑者: xgqfrms-GitHub,