• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to make text bold in Text Area

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
I want to make the content of the text area to be BOLD after mouse click event. I am able to call a java script function on mouse click .where I am having the logic for changing the plain text to bold.
This is the code I have written inside the function
function chanceText(){
var val =document.forms[0].text.value;
// 'text' is the text area name
document.forms[0].text.value=val.bold();
}
problem with the code is I am seeing HTML block code inserted .(<B></B>
If i have �July� in the text area, after execution of the function i see <B>July</B> instead of July being in block letters.
Please correct me where I am going wrong. If this issues is already discussed in the forum. Please pass on the message number.
Thanks,
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are not going to able to change part of the text to bold, the whole thing would have to become bold with the style property.
 
dinesh sundaram
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello eric,
thanks for your reply.
As per your suggestion. i used the following code which i refered from the link mentioned below. Even then i am seeing markup text .i am using IE6.
your suggestion will help me.
tutorial link:
http://www.oreillynet.com/pub/a/javascript/2001/12/21/js_toolbar.html
MY Code :
i tried to submit my code .but the server didn't allowed me saying "illegal markup character". please refer page2 of the tutorial.

Thanks
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are going to need to escape you code most likely before submitting
 
dinesh sundaram
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
eric,
do you want me submit the code...
~dinesh
PS: if you have sample code for the above problem. please post it.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
post the code that is giving you the problem.
If it is just the generated output, show that..
Eric
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic