Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need to modify boldText() script for multiple textfields

    Hey all,
    I've got this script:
    Code:
    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
    Last edited by markkanning; 12-09-2006 at 11:37 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •