Editor development: Basic JS commands

Source: Internet
Author: User
Recently, I have been studying the development of editors. There are few online examples of such items, because everyone is using a free editor or developed by others. Most of these editors are written in Js, today, I found a comprehensive method to reload Execcommand events on the Internet. All of them are forwarded for future query.
Id.doc ument. designMode = "on" cannot be edited when the IFRAME is editable to off
Id. Focus (); get the focus of the current IFRAME
Id.doc ument. selection. createRange ();
Id.document.exe ccommand (s); execute commands in the current document, selected area, or specified range
Execcommand Parameters
Id.document.exe ccommand ('cut '); cut
Copy id.document.exe ccommand ('copy ')
Id.document.exe ccommand ('paste ') Paste
Id.document.exe ccommand ('undo ') undo
Id.document.exe ccommand ('redo ') Redo
Id.document.exe ccommand ('delete') Delete
Id.document.exe ccommand ('bold ')
Id.document.exe ccommand ('italic ') Italic
Id.document.exe ccommand ('underline') Underline
Id.document.exe ccommand ('strikethangout'); draw a rough line on the selected text
Id.document.exe ccommand ('superscript'); Refine the selected text
Id.document.exe ccommand ('underline'); Removes the underline of the selected block.
Id.document.exe ccommand ('stop') Stop
Id.document.exe ccommand ('saveas') Save
Id.document.exe ccommand ('saveas', false, 'c: \ test.htm') Save
Id.document.exe ccommand ('fontname', false, ' ') the font must be a system-supported font. Both true and false can be used.
Id.document.exe ccommand ('fontsize', false, FS) font size
Id.document.exe ccommand ('refresh', false, 0) Refresh
Id.document.exe ccommand ('createlink ', true, 'true') in the displayed dialog box, enter a URL to create a hyperlink.
Id.document.exe ccommand ('createlink ', false, 'HTTP: // www.51js.com') to create a hyperlink
Id.document.exe ccommand ('backcolor', true, '# ffbbdd') can set the selected block to the specified background color either true or false.
Id.document.exe ccommand ('forecolor', false, '# bbddcc') specifies whether the foreground color is true or false.
Id.document.exe ccommand ('fontsize', false, 7) specifies whether the background color is true or false.
Id.document.exe ccommand ('insertorderedlist') is ordered in sequence.
Id.document.exe ccommand ('insertunorderedlist') solid non-sequential arrangement
Id.document.exe ccommand ('indent ')
Id.document.exe ccommand ('delete') deletes the selected block
Id.document.exe ccommand ('cut ') to cut down the selected block
Form class
Id.document.exe ccommand ('insertbutton', false, "AA") adds a new button true or false. invalid document. All. AA. value = "fengwu nine days"
Id.document.exe ccommand ('insertinputbuttong', false, "AA") adds an input value true or false. invalid document. All. AA. value = "Wind dance nine days"
Id.document.exe ccommand ('insertfieldset', true, "AA") is reset to a fieldset document. All. AA. innertext = "sword like a dream"
Id.document.exe ccommand ('inserthorizontalrule', true, "AA") inserts a horizontal line
Id.document.exe ccommand ('insertiframework', true, "AA") inserts an IFRAME
Id.document.exe ccommand ('insertimage', false, "AA") inserts an insertimage. If it is set to true, the image is required. If it is false, no image is needed.
Id.document.exe ccommand ('insertinputcheckbox', true, "AA") inserts a checkbox
Id.document.exe ccommand ('insertinputfileupload', false, "AA") inserts a file-type object
Id.document.exe ccommand ('insertinputhidden ', false, "AA") inserts a hidden
Id.document.exe ccommand ('insertinputimage', false, "AA") insert an inputimage document. All. AA. src = "F-a10.gif ";
Id.document.exe ccommand ('insertinputpassword', true, "AA") inserts a password
Id.document.exe ccommand ('insertinputradio ', false, "AA") inserts a radio
Id.document.exe ccommand ('insertinputreset', true, "AA") inserts a reset
Id.document.exe ccommand ('insertinputsubmit ', false, "AA") inserts a submit
Id.document.exe ccommand ('insertinputtext', false, "AA") inserts an input text
Id.document.exe ccommand ('inserttextarea ', true, "AA") inserts a textarea
Id.document.exe ccommand ('insertselectlistbox', false, "AA") inserts a select list box
Id.document.exe ccommand ('insertselectdroplow', true, "AA") inserts a single select
Id.document.exe ccommand ('insertparagraph') inserts a line break (hard press enter ??)
Id.document.exe ccommand ('insert', true, "AA") inserts a marquee document. All. AA. innertext = "bbbbb"
Id.document.exe ccommand ('unselect') is used to deselect the shadow part.
Id.document.exe ccommand ('selectall') selects all elements on the page
Id.document.execcommand('saveas', 'mycodes.txt '); the second parameter is the file name to be saved.
Id.document.exe ccommand ('print ') print the entire page
Id.document.exe ccommand ("superscript") superscript
Id.document.exe ccommand ("subscript") subscript
Id.document.exe ccommand ("outdent") Forward indent
Id.document.exe ccommand ("indent") indent backward
Id.document.exe ccommand ("justifyleft") to the left
Id.document.exe ccommand ("justifyright"): Right
Id.document.exe ccommand ("justifycenter") Center
Id.document.exe ccommand ("forecolor", "", ccolor) font color
Insert HTML in focus position
Id. Focus (); // obtain the focus of the current IFRAME
O = id.doc ument. selection. createRange (); // obtain the selected content in the text box
O. pastehtml (" ")

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.