HTML DOM Document executeCommand ()
Thí dụ
Làm cho văn bản đã chọn được in đậm:
document.execCommand("bold");
Định nghĩa và Cách sử dụng
Phương thức executeCommand () không được dùng nữa. Đừng sử dụng nó.
Thuộc tính applets trả về một HTMLCollection trống trong tất cả các trình duyệt mới.
Phần tử <applet> không được hỗ trợ trong HTML5.
Cú pháp
document.execCommand(command, showUI, value)
Thông số
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. |
Giá trị trả lại
Loại | Sự miêu tả |
Boolean | true nếu lệnh được hỗ trợ, ngược lại false . |