Simple buttons, click to add to textarea?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Breana
    New Member
    • Aug 2007
    • 117

    Simple buttons, click to add to textarea?

    Ok, i have made 4 buttons, little buttons called.
    B =Bold, --- =Line, U = Underline, SFT = Space just above my textarea About Me.

    [PHP] <tr>
    <td><input type="button" name="Button" value="B" onclick="Change Text(this.form. aboutme,);" />&nbsp;<input type="button" name="Button" value="U" onclick="Change Text(this.form. aboutme,;" />&nbsp;
    <input type="button" name="Button" value="LINE" onclick="Change Text(this.form. aboutme,[HR SIZE=1] [/HR];" />&nbsp;<input type="button" name="Button" value="SPACE" onclick="Change Text(this.form. aboutme,<BR />;"/>&nbsp;
    <br />
    <textarea name="aboutme" cols="50" rows="10" wrap="virtual" id="aboutme"></textarea></td></tr>[/PHP]

    How can i target the textarea when a user hits the button?
    So if help me1 is hilighted, and he/she hits B button it will change it to.
    help me!
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Breana.

    I'm going to go ahead and move this thread to the JavaScript forum, where our resident Experts will be better able to help you out.

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #3
      Originally posted by Breana
      How can i target the textarea when a user hits the button?
      help me!
      What do you mean by this line?

      Kind regards,
      Dmjpro.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        To access the textarea, use [CODE=javascript]document.getEle mentById("about me");[/CODE] You can style a textarea, but to create a WYSIWYG editor, you may need to learn about "designMode ".

        Comment

        Working...