Results 1 to 5 of 5

Thread: Make pic append text to text area.

  1. #1
    Join Date
    Oct 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Make pic append text to text area.

    Hello,

    Beeing completely new to javascript im struggeling to find an example of making a click on a pic append a text connected to that pic to a text area.

    something like <img src="catpic.gif" onClick('cat')>
    then populate <textarea name="text1"...> with this...

    Anyone have a small example to show me?

    /Nub

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,373
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    HTML Code:
    <img src="catpic.gif" onclick="document.getElementById('catCap').innerHTML='I\'m a cat!'"><br>
    <span id="catCap"></span>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Oct 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi, and thanks for the prompt reply!

    This displays the text "I'm a cat"

    but what Im really looking fore is a way fo getting it into a textarea and append it to any text I might have already enterd there, so that I can then use the form data from that field.

    So instead of the
    <span id="catCap"></span>
    I need a way of inserting "I'm a cat" in:

    <textarea id="catCap">
    </textarea>

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,373
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    HTML Code:
    <img src="catpic.gif" onclick="document.getElementById('catCap').value+='I\'m a cat!'"><br>
    <textarea id="catCap"></textarea>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Oct 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks John!
    Just what I was after
    Lean and simple! (once you know how)

    - Mikael

Bookmarks

Posting Permissions

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