...

View Full Version : Trouble With styling a text



WebDeveloper
08-12-2008, 12:05 AM
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 :


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

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-12-2008, 12:20 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum