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 7 of 7
  1. #1
    Regular Coder
    Join Date
    Feb 2004
    Location
    Scotland
    Posts
    135
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Inserting text into textarea via link.

    I wish to have a set of links that when clicked on enter's some text into a textarea.

    I am going to use it to create a forum to add things like "[url]" and so forth.

    This is probably really simple, but I'm rubbish at Javascript.

    Thanks a lot,

    TD.
    Last edited by spl1nter; 02-02-2004 at 09:11 PM.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    document.formname.textboxname.value='your message';

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #3
    Regular Coder
    Join Date
    Feb 2004
    Location
    Scotland
    Posts
    135
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How would I implement this onto the page? I tried using <a href="javascript: onClick=document.formname.textboxname.value='whatever';></a>, but it posted the text on a new page?

    I changed the name of the form and textbox to match the code.

    I told you I'm useless at Javascript :P

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    buttons tend to have better functionalty but you can use links.
    Code:
    <input type="button" value="Click ME!" onClick="document.formname.textboxname.value='boo'">

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #5
    Regular Coder
    Join Date
    Feb 2004
    Location
    Scotland
    Posts
    135
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks a lot. Works great now

  • #6
    New to the CF scene
    Join Date
    Feb 2004
    Location
    Belgium
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I need more help ,

    It dous work but I need the function to ADD some text or in this case a Tag to the textarea .

    Like the function is now it overwrite all the data inside it .

    Thanks in advance

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,045
    Thanks
    0
    Thanked 251 Times in 247 Posts
    onClick="document.formname.textboxname.value+=' added text'">


  •  

    Posting Permissions

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