Documento HTML DOM execCommand()
Exemplo
Coloque o texto selecionado em negrito:
document.execCommand("bold");
Definição e uso
O método execCommand() está obsoleto. Não use isso.
A propriedade applets retorna um HTMLCollection vazio em todos os novos navegadores.
O elemento <applet> não é compatível com HTML5.
Sintaxe
document.execCommand(command, showUI, value)
Parâmetros
Parameter | Description |
command |
The name of the command to execute:
"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 | A Boolean. Specifies if the UI should be shown or not. |
value | Some commands need a value to be completed. |
Valor de retorno
Modelo | Descrição |
boleano | true se o comando for suportado, caso contrário false . |