...

View Full Version : Need to modify boldText() script for multiple textfields



markkanning
12-09-2006, 10:33 PM
Hey all,
I've got this script:


function boldText(textAreaId) {
var str = document.selection.createRange().text;
document.my_form.myTextarea.focus();
var sel = document.selection.createRange();
sel.text = "<b>" + str + "</b>";
return;
}

It's works just fine for adding bold text to one <textarea> on a page. However, I need it to work for multiple textareas with multiple instances of a text-formatting toolbar that are being populated by a PHP for loop. As you can see, the script needs to refer to an id of "myTextarea". It won't work if I change the reference to "myTextarea" to the more generic textAreaId.

Any thoughts?

Mark



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum