#1
  1. Permanently Banned
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2006
    Location
    In a whale
    Posts
    4,147
    Rep Power
    0

    Shout box emoticons.


    Hi, right now I have a code that does what I want, put an emoticon in the box. But it only does it once and when there is no text in there. Any solutions. My code:
    javascript Code:
    <script>
    function emoticon(id,emoid)
    {
    	document.getElementById(id).innerHTML=emoid
     
    }
    </script>
    <a href="javascript:emoticon('box','-_-')">Click</a>
    <textarea id='box'></textarea>
    Last edited by BlackNine; October 26th, 2006 at 03:27 PM.
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,128
    Rep Power
    4304
    Don't use the innerHTML property of a textarea, use it's value property instead. Use the concatenation operator to add the text to the end of the text in the textarea.

    Code:
    function emoticon(id,emoid) {
      document.getElementById(id).value+=emoid;
    }

    Comments on this post

    • ryon420 agrees : Thanks, it worked, sorry I cant give you more point though :(
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo