473,385 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Can textareas be styled with javascript?

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
Jul 23 '05 #1
3 1289
http://www.brayneychyled.com/helpoutsometimes.htm
"Jason Kirk" <us****@captain.custard.org> wrote in message
news:pa***************************@captain.custard .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

Jul 23 '05 #2


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/
Jul 23 '05 #3
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
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Sander Voerman | last post by:
Hi, I am going to make a forum using PHP. However, I have a very simple question to begin with. Is it at all possible to create input fields where users can type their messages using italic,...
7
by: TValdo | last post by:
Hello everyone! I'm having strange problems with textareas... This is my situation: I have a document, which opens in a pop-up, with a form (let's call it form1). This form contains 3 hidden...
4
by: muesliflakes | last post by:
I am using styled buttons which look really good, my problem is that the 1st button on the page has an ugly black square arround it. I think this might indicate the default button when enter is...
5
by: Mark | last post by:
How do I scroll two textareas in sync with FireFox/Mozilla? The IE solution has been posted before by Martin Honnen.
2
by: johnny | last post by:
hi all, I have troubles with a css styled form: I cannot make an upload field staying into a fixed column , say 100 pixels wide. It could be enough to have the file browse button below the...
6
by: Phil Endecott | last post by:
Dear Experts, I have some Javascript code that reads and sometimes sets the content of a textarea. I want this to be reasonably browser and platform independent. My question is, what...
8
by: =?Utf-8?B?QkxVRVNUQVI=?= | last post by:
HELLO, I AM A NEW BII TO ASP,AND I NEED HELP ON THIS ISSUE. I HAVE A .ASP FORM WHICH IS ALREADY BUILT WITH 5 QUESTIONS AND 5 TEXTAREAS RESPECTIVELY.THESE 5 QUESTIONS ARE NOT FIX,THERE WILL BE...
2
by: PHPstarter | last post by:
Hi guys. I have 3 textareas, and I have a button to clear them. I used a standard form with onlick="document.formname.textareaname.value = '';"> But it stopped working when there was added more...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.