3 replies [Last post]
mute8
Offline
newbie
Last seen: 15 years 38 weeks ago
Joined: 2004-06-03
Posts: 2
Points: 0

Hi all,

Is it possible to format text that will appear within a textarea element?
What I am trying to do is display a bunch of styled divs within the textarea, but I just get the HTML appearing rather than the divs?

Example:-

<textarea name="NAME" cols=100 rows=20 wrap=off readonly>

<div style="position: absolute; color: white; font-size: 12; font-family: verdana, arial, sans-serif; left: 0; top: 0; background-color: gray; width: 160; height: 10;">Name</div>
<div style="position: absolute; color: white; font-size: 12; font-family: verdana, arial, sans-serif; left: 382; top: 0; background-color: gray; width: 386; height: 10;">Text</div>

</textarea>

Thanks very much Smile

co2
co2's picture
Offline
Leader
UK
Last seen: 11 years 46 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

text formatting within a textarea

Don't think you can. You can style the text that is contained within a textarea, such as: http://pub.c-o2.net/cssf/textArea.htm

But you can't contain HTML elements within (as far as I know).

What are you trying to achieve anyway?

The next sentence is true. The previous sentence is false. Discuss...

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 4 years 4 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

text formatting within a textarea

I know Yahoo! mail has a textarea that you can compose HTML emails in, with bold, italic etc etc... imagine Hotmail etc will do as well - guess it's something like that.

I have no clue how it's done though!

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

mute8
Offline
newbie
Last seen: 15 years 38 weeks ago
Joined: 2004-06-03
Posts: 2
Points: 0

text formatting within a textarea

I wanted to use the textarea to display formatted output from a database query. Basically I wanted to display each field in the table a different way (displaying fields in different colours according to their importance, substituting a graphic for some text items, that sort of thing).

I think I'm probably going to have to use an iframe, but there are cross-browser issues there which would be avoided by using a textarea instead.

Thanks for all you help so far - I'll build the page with an iframe for now, and see if anyone comes back with anything that'll enable me to switch to a textarea later.