[thelist] Re: thelist digest, Vol 1 #2714 - 6 msgs

colin bocmaxima at wtez.net
Wed Oct 30 16:29:01 CST 2002

> Hmm, not really, that would color all text within the textarea.
> I'm looking to color only specific portions of the text.

The problem is that TEXTAREA is almost like PRE, and renders all code as
literal, so writing in SPAN tags is not an option, since you'd have to
separate each word.
You'd have to do it through JavaScript's split method.
First name the TEXTAREA (e.g. - "textual")
The script would be as follows:

var words = document.formname.textual.split(" ");

You would then be able to render what they had written somewhere else, but
not in a TEXTAREA by changing the colors and using document.write()

I had thought that you could use psuedo elements, but TEXTAREA does not
support them. I assume you'd want the text to change color as they wrote it,
this is impossible if you want it to render in the existing TEXTAREA, but as
I said, you can get it to appear somewhere else as they write it, although
this would be a much more complicated script than what I have above.

Hope that answers your question,

bocmaxima at wtez.net

More information about the thelist mailing list