SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Addict Ghz's Avatar
    Join Date
    Jun 2002
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onClick insert a text in a text area

    Hi there,
    I've been searching for this function to complete my script. In brief I want to have a text area where I can write anything in it. And beside it I want to have a picture or a botton and if I clicked that botton it inserts a text in the text area. The idea is similare to the clickable smilies in this forum. Is there any pice of code that I can use to do this job to me?

    Any help would be appreciated in advance

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simple example:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
    <html>
      <head>
        <title>Title</title>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
        <script type="text/javascript">
          function insertText(elemID, text)
          {
            var elem = document.getElementById(elemID);
            elem.innerHTML += text;
          }
        </script>
      </head>
      <body>
        <form>
          <textarea id="txt1"></textarea>
          <input type="button" value="Insert some text" onclick="insertText('txt1', 'Hello');">
        </form>
      </body>
    </html>

  3. #3
    SitePoint Addict Ghz's Avatar
    Join Date
    Jun 2002
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx jofa that worked just FINE

    How about the script that is used to post an image code in my post at this forum? I mean the prompt script which gives you the ability to add an image code in your post...May I have that pice of code too?

    Thanx in advance

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    SitePoint Addict Ghz's Avatar
    Join Date
    Jun 2002
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's cool but where can get the source code? I tried to view it's source using the notepad But it didn't worked fine.
    May I have that source for the TAEditor???

  6. #6
    SitePoint Addict Ghz's Avatar
    Join Date
    Jun 2002
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay thanx alot beetle I found my mistake. now it's working just great thank youuuuuuuuuuuuuu

  7. #7
    SitePoint Addict Ghz's Avatar
    Join Date
    Jun 2002
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey jofa can I change the button into an image?? I tried to do it but I failed..plz

    Thanx

  8. #8
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input type="image" ...> maybe?
    Or just an <img> with an onclick event handler added

  9. #9
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Be careful with <input type="image" ...>, they submit the form when clicked!
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  10. #10
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...if you don't return false ?

  11. #11
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Correct
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  12. #12
    SitePoint Addict Ghz's Avatar
    Join Date
    Jun 2002
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It didn't work and you can try that jofa I simply need a smily system just like the one in here...

    Thanx for the help


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
  •