HTML DOM Document execCommand() 方法
实例
使选定的文本加粗:
document.execCommand("bold");
亲自试一试
语法
document.execCommand(command, showUI, value)
参数
参数 |
描述 |
command |
要执行的命令的名称:
- "backColor"
- "bold"
- "createLink"
- "copy"
- "cut"
- "defaultParagraphSeparator"
- "delete"
- "fontName"
- "fontSize"
- "foreColor"
- "formatBlock"
- "forwardDelete"
- "insertHorizontalRule"
- "insertHTML"
- "insertImage"
- "insertLineBreak"
- "insertOrderedList"
- "insertParagraph"
- "insertText"
- "insertUnorderedList"
- "justifyCenter"
- "justifyFull"
- "justifyLeft"
- "justifyRight"
- "outdent"
- "paste"
- "redo"
- "selectAll"
- "strikethrough"
- "styleWithCss"
- "subscript"
- "superscript"
- "undo"
- "unlink"
- "useCSS"
|
showUI |
布尔值。指定是否应显示 UI。 |
value |
有些命令需要值才能完成。 |
返回值
类型 |
描述 |
布尔值 |
如果支持该命令,则为 true,否则为 false。 |