Jump to content

[SOLVED] Smiley buttons that insert : ) or ; ) when clicked to a text box.


lynxus

Recommended Posts

Hi guys,

 

I have a form:

<input name="message" type="text" class="texta"  id="message" style="width:100%" onFocus="this.value=''" onKeyPress="handleEnter(this, event)" value="Type your message here , Then press Return/Enter."   />

 

I also have a bunch of smiley images. ( like above in the phpfreaks reply form )

 

How can i get it so if someone clicks an image, It will update the text field in my code with the required chars, ie: if someone clicked the smile icon it would append : ) at the end of the text field ( without overwriting what migth already be in it )

 

Any ideas?

 

My javascript is very very flaky.

I would assume it would be something like.

 

document.message = document.message + ": )";

 

Or along those lines..

How its actualy coded i have no clue or called.

 

Thanks

Graham

Ah ha , figured it out :)

 

<script type="text/javascript" language="javascript"><!--

function ChgText(code)
{
   	var message = document.getElementById("message");
  	message.value = message.value + code;
message.focus();

}

//--></script>

 

Ty all ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.