Different Colors of Text in Textareas

liunx

Guest
Hey everyone.<br />
<br />
I have a dilema, kind of.<br />
<br />
Let me first explain what it is that I am trying to do. I am designing a cgi-based chat room system. I would like to enhance it visually a little bit by jazzing up the text in the <textarea> element. I want to display the username of the user who made the comment in a color such as red and then the actual message in black. In other words something along these lines:<br />
<br />
<font color=red>User:</font> yadda yadda yadda<br />
<font color=red>User2:</font> yadda2 yadda2 yadda2<br />
<br />
where the yaddas are all black.<br />
<br />
I have tried embedding html tags in between the <textarea> tags, but with no luck.<br />
<br />
I have seen something like this done before I belive, but I am not sure. I am not interested in implementing this in Java yet, by the way.<br />
<br />
Any suggestions/help is greatly appreciated.<br />
<br />
Thanks in advance.<br />
<br />
Ken<!--content-->I don't really understand what you are trying to do by reading your post. Do you want to change the color of text that is entered into the textarea of a form?<br />
<br />
I know how to globally change all the text in a textarea element but not how to use multiple colors within the same element.<br />
<br />
<textarea name=comments COLS=60 ROWS=10 style="font-family:Arial; color:red;"><br />
<br />
You can use that same code to change text/fonts in any element of a form. Does not work in all browsers.<br />
<br />
Regards,<br />
Kevin<!--content-->Thanks for the reply.<br />
<br />
What I am trying to do is use a textarea to DISPLAY the text only. It is a chat room type application where the current conversation is kept in a flat ascii file. I read the file and display its contents in the textarea in question. Now, the data in the file is stored with the username of the person contributing to the conversation, a colon, and then their respective message. So a sample of the file may be something like so:<br />
<br />
User: yadda<br />
User2: yadda2<br />
<br />
Now, when the file gets read and placed into the textarea for VIEWING only, I want the username to be a different color than the message. To answer one of your questions, I want to use multiple colors in the textarea for different "sections" of the textarea. So, i kinda want to be able to set the color property of it dynamically for different parts of the data. The same way a Rich Text Box can be used in Windows (if you know what i'm talking about). It is a difficult idea to convey properly, on top of the fact that I don't think it can be done with html/dhtml/js/vbs/css or the such.<br />
<br />
I'm not sure how much more descriptive I can be, but if there are any more questions about exactly what I am trying to do, I'll try because I really want to get this to work if possible.<br />
<br />
Thanks<!--content-->OK...that explanation is more clear. Maybe you can use different colored fonts within the same textarea but I don't know how to do that. Sounds like a job for JAVA or VBS if it's possible. <br />
<br />
Regards,<br />
Kevin<!--content-->
 
Back
Top