HTML DOM Document execCommand() 메서드

정의와 사용법

execCommand() 메서드는 더 이상 사용되지 않습니다. 사용하지 마세요.

applet 속성은 모든 새 브라우저에서 비어 돌아갑니다. HTMLCollection.

HTML5는 <applet> 요소를 지원하지 않습니다.

대체方案:

Document designMode 속성

Element contentEditable 속성

예제

선택된 텍스트를 굵게 만들기:

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입니다.