Home arrow HTML arrow Page 3 - Building a WYSIWYG HTML Editor Part 1/2
HTML

Building a WYSIWYG HTML Editor Part 1/2


Whether you're creating your own personal web site, a site for a medium sized business, or a site for a company intranet, the content management system (CMS) is one of the most important aspects of the overall design. In this article Mitchell shows us how to build an awesome browser based HTML editor using only HTML and JavaScript. This article is a must read!

Author Info:
By: Mitchell Harper
Rating: 5 stars5 stars5 stars5 stars5 stars / 398
February 27, 2002
TABLE OF CONTENTS:
  1. · Building a WYSIWYG HTML Editor Part 1/2
  2. · Why a WYSIWYG editor
  3. · execCommand examples
  4. · Building our HTML editor
  5. · Building our HTML editor (contd.)
  6. · Building our HTML editor (contd.)
  7. · Conclusion

print this article
SEARCH DEVARTICLES

Building a WYSIWYG HTML Editor Part 1/2 - execCommand examples
(Page 3 of 7 )

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 select region being bolded.
  • Italic: Toggles between the selected region being italicised.
  • Underline: Toggles between the select 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.
blog comments powered by Disqus
HTML ARTICLES

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials