textareacannot display content as you want, they only display text. I would suggest an editor in the browser. Good CodeMirror , which is pretty easy to use:
HTML
<textarea id="code" name="code">
function StringStream(string) {
this.pos = 0;
this.string = string;
}
...
</textarea>
Javascript
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true
});
And CodeMirror inserts an editable block with this content into a new editor.
. Wikipedia Javascript.