View Full Version : Trouble With styling a text

08-11-2008, 11:05 PM
I'm Building a HTML Page Builder . I'm Trying To Create a Function To Bold a text in a textarae . after thinking i came up with this :

function BoldMyText ()
TextEditor.Text.style.cssText = "font-weight : bold"
<form name = "TextEditor">
<textarea name = "Text"></textarea>
<input type = "button" value = "Bold It" onClick = "BoldMyText ()">

But The Problem With This Script is that is the function is bolding the hole text of the textarea . and when i created an UnBolding function it unbolded the hole text in the textarea .
The Problem Is How To Bold a Selected Text In The Textarea ???

rnd me
08-11-2008, 11:20 PM
you can't. the text in a textarea is all presented the same way. you could add the html code to make the selection bold, but the code would showup in the text, and it would not be bold.