เอกสาร HTML DOM execCommand()
ตัวอย่าง
ทำให้ข้อความที่เลือกเป็นตัวหนา:
document.execCommand("bold");
ความหมายและการใช้งาน
execCommand() วิธีการเลิกใช้แล้ว อย่าใช้มัน
คุณสมบัติ applet ส่งคืน HTMLCollection ที่ว่างเปล่าในเบราว์เซอร์ใหม่ทั้งหมด
<applet> องค์ประกอบไม่ได้รับการสนับสนุนใน HTML5
ไวยากรณ์
document.execCommand(command, showUI, value)
พารามิเตอร์
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. |
คืนมูลค่า
พิมพ์ | คำอธิบาย |
บูลีน | true false หากได้รับการสนับสนุนคำสั่ง มิฉะนั้น |