Execcommand under IE and Firefox

Source: Internet
Author: User
Compared with setting properties, addeventlistener () and removeeventlistener () have the advantage of setting multiple listeners for the same event and calling different functions. Therefore, to delete an event listener, the three parameters required to be passed are identical to the three parameters set during addition. Mozilla does not support Internet Explorer to convert the "script" tag into an event. Program The for and event attributes are added to the script (as shown in table 5 ). The attachevent and detachevent methods are not supported. Instead, use the addeventlistener and removeeventlistener methods. Internet Explorer does not support W3C event standards. Table 5. Differences between Mozilla and Internet Explorer event Methods Internet Explorer method Mozilla method description attachevent (aeventtype, afunctionreference) addeventlistener (aeventtype, afunctionreference, ausecapture) adds event listeners to DOM elements. Detachevent (aeventtype, afunctionreference) removeeventlistener (aeventtype, afunctionreference, ausecapture) deletes event listeners from DOM elements. Rich text editing although Mozilla is the most W3C-compliant browser, it can also support non-standard features, such as innerhtml and rich text editing, if there is no W3C standard. Mozilla 1.3 implements the design mode feature of Internet Explorer and converts HTML documents into a rich text editor field. After the editor is changed, Execcommand can be used to execute commands in the document. Mozilla does not support the contenteditable attribute of Internet Explorer, which allows editing of any component. You can use IFRAME to add a rich text editor. Rich Text differences Mozilla supports iframeelm. contentdocument accesses the W3C standard of IFRAME document objects, while Internet Explorer requires that you use document. frames ["name"] accesses it and then accesses the final document: function getiframedocument (AID) {var Rv = NULL; // If contentdocument exists, W3C compliant (Mozilla) if (document. getelementbyid (AID ). contentdocument) {Rv = document. getelementbyid (AID ). contentdocument;} else {// ie? Rv = document.frames?aid=.doc ument;} return RV;} another difference between Mozilla and Internet Explorer is the HTML created by the rich text editor. Mozilla uses CSS for the generated tag by default. However, Mozilla allows you to switch between HTML and CSS by changing usecss Execcommand to true and false. Internet Explorer always uses HTML tags. Mozilla (CSS ): Big blue Mozilla (HTML): Big Blue Internet Explorer: Big Blue lists the Execcommand commands supported by Mozilla: Table 6. the bold parameter specifies whether the selected content is displayed in bold. --- CreateLink creates an HTML link from the selected text. URL Delete to delete the selected content. --- Fontname changes the font of the selected text. Fontsize used to change the font size of the selected text. The fontcolor used to change the font color of the selected text. The color indent used to indent the block where the cursor is located. --- Inserthorizontalrule Insert at the mouse position

Element. --- Insertimage insert an image at the mouse position. The URL insertorderedlist of the image is inserted into the ordered list (

) Element. --- Insertunorderedlist insert unordered list (

) Element. --- Italic switches the Italic attribute of the selected content. --- Justifycenter: The current row is centered and aligned. --- Justifyleft: The current row is left aligned. --- Justifyright: The right of the current row. --- Outdent: reduce the indentation of the block where the cursor is located. --- Redo resumes the previous command for revocation. --- Removeformat removes all the formats of the selected content. --- Selectall: select all content in the rich text editor. --- Strikethrough switches the strikethrough of the selected text. --- Subscript changes the selected content to a subscript. --- Superscript converts the selected content to the superscript. --- Underline add or delete the underline of the selected text. --- Undo: Undo cancels the last action. --- Unlink: deletes the link information of the selected content. --- Usecss uses/does not use CSS in the generated tag. For more information about boolean values, visit devedge.

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.