Jump to content

Need to fix this code


vividona

Recommended Posts

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

<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(':-(')" />

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.