Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Can textareas be styled with javascript?

Reply
Thread Tools

Can textareas be styled with javascript?

 
 
Jason Kirk
Guest
Posts: n/a
 
      06-12-2005
I'm going to be using a textarea to edit some XML data. It would make my
life easier if I could add some really simple dynamic syntax highlighting
to the textarea. Is this possible with javascript?

I suspect I'll have to hackdown a RTE wysiwyg script, but I'd rather just
stick with a nice simple textarea if I can.

-Jason


 
Reply With Quote
 
 
 
 
Sympatico Member
Guest
Posts: n/a
 
      06-12-2005
http://www.brayneychyled.com/helpoutsometimes.htm
"Jason Kirk" <(E-Mail Removed)> wrote in message
news(E-Mail Removed) .org...
> I'm going to be using a textarea to edit some XML data. It would make my
> life easier if I could add some really simple dynamic syntax highlighting
> to the textarea. Is this possible with javascript?
>
> I suspect I'll have to hackdown a RTE wysiwyg script, but I'd rather just
> stick with a nice simple textarea if I can.
>
> -Jason
>
>



 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      06-12-2005


Jason Kirk wrote:

> I'm going to be using a textarea to edit some XML data. It would make my
> life easier if I could add some really simple dynamic syntax highlighting
> to the textarea. Is this possible with javascript?


You can try to apply CSS (statically or dynamically with script) to the
textarea and some browsers might apply that CSS but of course then to
the whole content of the textarea and not to some content which you
probably want if you want to do syntax highlighting.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
RobG
Guest
Posts: n/a
 
      06-14-2005
Jason Kirk wrote:
> I'm going to be using a textarea to edit some XML data. It would make my
> life easier if I could add some really simple dynamic syntax highlighting
> to the textarea. Is this possible with javascript?
>
> I suspect I'll have to hackdown a RTE wysiwyg script, but I'd rather just
> stick with a nice simple textarea if I can.
>


The content of a textarea elements is PCDATA. General HTML markup is
ignored but character entities are not (at least in all the browsers I
tested).

For example:

<textarea><B>blah</B></textarea> --> <B>blah</B>

<textarea>&amp;blah&gt;</textarea> --> &blah>

Also:

<textarea>blah \n blah</textarea> --> blah \n blah

and (when clicked on):

<textarea onclick="this.value="blah\nblah">

--> blah
blah



--
Rob
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading information from TextAreas MacEgan Java 2 12-17-2005 11:34 PM
Reading information from TextAreas MacEgan Java 1 12-17-2005 07:33 PM
Gridview: can column contents be programmatically styled? ASP .Net 1 08-16-2005 10:42 AM
Page test: expando textareas Jeff Thies HTML 4 07-02-2004 06:15 AM
Can the DIV tag be STYLEd with only a vertical scroll bar? Guy HTML 1 12-13-2003 04:48 AM



Advertisments