Click to See Complete Forum and Search --> : I need a script


Zach Elfers
11-26-2002, 08:59 PM
I have a textarea and some buttons above which have Bold, Italic, and Underline on them. I want a script that would do this: the visitor would type some text in the textarea and select the text they want to add formatting too; then, after they had clicked one of the above buttons, JavaScript would add HTML formatting to the selected text like <b> or something. Thanks.:)

tomroten_10
11-28-2002, 02:27 AM
You could just prompt the user for the text using:

var whatever = prompt("Text Here?", "");

Then have buttons for italics or bold on the page and then when they click it you could use this:

var whatever_in_italics = whatever.italics();

Then you could display the new text on the page by using:

document.writeln(whatever_in_italics)

Zach Elfers
11-29-2002, 08:00 PM
Originally posted by Dave Clark
Here is an example of the kind of coding you're going to need (IE-only, at the moment):

http://www.DaveClarkConsulting.com/research/insert_at_caret.html

Dave

Thanks!!