Javascript Editor

This page demonstrates a basic Javascript HTML editor. There are much more advanced editors out there, but I developed this one so it can easily replace text area's in web pages.

The main advantage is that it stores line breaks as normal line breaks, not as <p> or <br/> tags, on both Firefox and Internet Explorer. This means that if a user does not have a capable browser, then can still edit the text, without having to deal with extraneous tags (though the breaks will have to be reinserted when the text is displayed). The editor uses objects, so that all the code is self contained. You can have many editors on the same page. And it produces consistent tags on Internet Explorer and Firefox (<u>, <em> and <strong>).

View the Javascript source, and use code like this to put it in a page: <script>new HtmlEditor('editor', 8, 58, "", "", "")</script>.

Update on 18/9/2009 - this is very old now and I recommend using TinyMCE or FCKeditor instead. You can put this at the top of a page to turn all <TEXTAREA> tags into HTML editors:
<script type="text/javascript" src="http://tinymce.moxiecode.com/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">tinyMCE.init({mode : 'textareas', theme : 'simple'});</script>