lynxus Posted September 3, 2009 Share Posted September 3, 2009 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 Link to comment https://forums.phpfreaks.com/topic/172953-solved-smiley-buttons-that-insert-or-when-clicked-to-a-text-box/ Share on other sites More sharing options...
lynxus Posted September 3, 2009 Author Share Posted September 3, 2009 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 Link to comment https://forums.phpfreaks.com/topic/172953-solved-smiley-buttons-that-insert-or-when-clicked-to-a-text-box/#findComment-911564 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.