Ok - you would actually use javascript just like the board does here to do it.
Now, with that said - you are using XUL, so a more robust solution would be just to create a WYSIWYG editor to format the code within the <textarea> with real-time preview.
Check out some of the projects on mozdev.org - download a few of them and have a peak at the code to see how they have done it.
If you still want to do it like this forum does, just save a forum page and look through the javascript to get an idea of how they do it. |