Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project



Building a WYSIWYG HTML Editor Using Only JavaScript and HTML



execCommand examples

Now that we're a little bit more familiar with the execCommand method, let's look at a list of some of the commands that we can perform with it (the complete list is available here):

  • ForeColor: Get or set the foreground color of the selected region.
  • BackColor: Get or set the background color of the selected region.
  • Bold: Toggles between the selected region being bolded.
  • Italic: Toggles between the selected region being italicised.
  • Underline: Toggles between the selected region being underlined.
  • Copy: Copies the selected region to the clipboard.
  • Cut: Removes the selected region from the document.
  • Paste: Adds data from clipboard to region (if applicable).
  • InsertHorizontalRule: Adds a horizontal rule to the region.
  • InsertImage: Displays an IE defined modal dialog that contains full image selection features, alt tag modification, border setting, etc.
  • InsertMarquee: Converts the selected text into a marque.
  • InsertSelectDropDown: Adds a drop down list to the region.
  • Print: Displays the windows print dialog so that the region can be printed.
  • Refresh: Refreshes the region.
  • CreateLink: Displays an IE defined modal dialog that lets you add a hyperlink using either selected text or new text.
  • InsertUnorderedList: Toggles between the selected text being an unordered list and normal text.

As you can see, we can do some pretty powerful things with the execCommand method. Let's build an advanced HTML content editor that allows us to toggle between HTML mode and WYSIWYG mode, format text, add images, links, lists and more.

 
  1 2 3 4 5 6 7
 
   
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information
knoxville photographer
knoxville wedding photographer