![]() | ![]() | ![]() |
| |||||||
| Forums | Register | Groups | Awards | Arcade | Pets | T-Bucks / T-Store | Invite Your Friends | Blogs | Mark Forums Read |
| Web Design Forums and discussions on webdesign |
Web Design | |||||||||
|
|
|
|
| |||||
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Civilians | Hi folks, I was wondering whether it is possible to colour some text within a textarea a different colour than the rest of the text? JavaScript would be fine for this (and I suspect it is the *only* way to do it client side) as it's only for bells and whistles. I ask this because I have a textarea that I am typing XML into and would like to be able to apply basic syntax highlighting so that the tags stand out a little more. Has anybody tried to do this? Cheers, -- Dylan Parry http://webpageworkshop.co.uk -- FREE Web tutorials and references Nutritional Information: This post contains no added salt or sugar, and is the only post proven to actually *lower* your cholesterol. |
|
| | #2 (permalink) |
| Civilians | And lo, Dylan Parry didst speak in alt.www.webmaster: > Hi folks, > > I was wondering whether it is possible to colour some text within a > textarea a different colour than the rest of the text? JavaScript would > be fine for this (and I suspect it is the *only* way to do it client > side) as it's only for bells and whistles. > > I ask this because I have a textarea that I am typing XML into and would > like to be able to apply basic syntax highlighting so that the tags > stand out a little more. Has anybody tried to do this? It would probably be necessary to "fake it" with a similarily styled <div>. Allow users to type in a normal textarea, but after each keypress the results would appear syntax-highlighted up above. It would require Javascript, and two views of the code at once, but it would work. Alternatively, if you could jigger a way to show users the location of the cursor, you could hide the textarea (or at least make it really really small), while still applying focus to it, so it would appear that the user was typing directly into the <div> Grey -- The technical axiom that nothing is impossible sinisterly implies the pitfall corollary that nothing is ridiculous. - http://www.greywyvern.com/orca#rsear - Orca Search: Full-featured spider and site-search engine |
|
| | #3 (permalink) |
| Civilians | Dylan Parry wrote: > I have a textarea that I am typing XML into and would like to be able > to apply basic syntax highlighting so that the tags stand out a little > more. I would expect that the only way to do this (well) would be to create a Java/Flash applet to implement the widget for you. Java would probably be a good choice as it has fairly mature XML support: you could add more than just syntax highlighting: e.g. automatic closing tags (type "</" and the editor finishes closing the most recently opened element for you) and a well-formedness check. -- Toby A Inkster BSc (Hons) ARCS Contact Me ~ http://tobyinkster.co.uk/contact |
|
![]() |
| Bookmarks |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| textarea rows | Sig | Web Design | 6 | 10-23-2005 18:02 |
| Can you add maxlength to a TEXTAREA field in a form | Serg | Web Design | 1 | 10-03-2005 22:00 |
| Highlighting Row | Mike | Microsoft Applications | 1 | 02-08-2005 16:00 |
| HTML Textarea Replacment | Jeremy Ross | Web Design | 3 | 11-05-2004 16:00 |
| Help with syntax | PRDuPont | Microsoft Applications | 1 | 06-16-2004 05:47 |
![]() | ![]() | ![]() |