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 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    27
    Thanks
    1
    Thanked 0 Times in 0 Posts

    I need also to fix this code

    Sorry guys,

    I am stupid in JS

    my smileys inserted verygood in textarea. But if you delete smiley code and need to insert new one the previous code will be there.

    PHP Code:
    <script type="text/javascript"
        function 
    insertSmiley(smiley
        { 
            var 
    currentText document.getElementById("message"); 
            var 
    smileyWithPadding " " smiley " "
            
    currentText.innerHTML += smileyWithPadding
        } 
    </script>
    <textarea name="message" rows="5" id="message"></textarea>

    <img src="interface/bigSmile.gif"     onclick="insertSmiley(':-D')" /><br>
    <img src="interface/cantLook.gif"     onclick="insertSmiley(':-P')" />
    <img src="interface/cry.gif"          onclick="insertSmiley(':=(')" />
    <img src="interface/devious.gif"      onclick="insertSmiley('=:)')" />
    <img src="interface/huh.gif"          onclick="insertSmiley('o_0')" />
    <img src="interface/knockedOut.gif"   onclick="insertSmiley('x-)')" />
    <img src="interface/puzzled.gif"      onclick="insertSmiley(':-~')" />
    <img src="interface/regularSmile.gif" onclick="insertSmiley(':-)')" />
    <img src="interface/shocked.gif"      onclick="insertSmiley(':-o')" />
    <img src="interface/snooze.gif"       onclick="insertSmiley('z:-)')" />
    <img src="interface/tongue.gif"       onclick="insertSmiley(':-P')" />
    <img src="interface/unsure.gif"       onclick="insertSmiley(':-/')" />
    <img src="interface/upset.gif"        onclick="insertSmiley(':-(')" /> 

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    From the guidelines:
    2) Type in a subject that summarizes your question- A great way to turn off other members wanting to help you is to type an incomplete or silly subject for your post.
    Are you a Help Vampire?

  • Users who have thanked tomws for this post:

    vividona (01-30-2010)

  • #3
    Regular Coder hdewantara's Avatar
    Join Date
    Aug 2009
    Location
    Jakarta, Indonesia.
    Posts
    366
    Thanks
    9
    Thanked 53 Times in 52 Posts
    Shouldn't it be like:
    Code:
    currentText.value += smileyWithPadding;


  •  

    Posting Permissions

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