Obsah

Smilies

Česky: VkladaniSmajliku

About

Smilies are favourite feature in guetbooks, forums and so. With this JavaScript solution can smilies be inserted before or after the cursor.

Example


Source code

<textarea id="text" cols="50" rows="5"></textarea>
<br>
<input type="button" value=":-)" onclick="smilie('text', ':-)')">
<input type="button" value=";-)" onclick="smilie('text', ';-)')">
<input type="button" value=":-(" onclick="smilie('text', ':-(')">
<input type="button" value=":-D" onclick="smilie('text', ':-D')">
<input type="button" value=":-P" onclick="smilie('text', ':-P')">
<input type="button" value="8-)" onclick="smilie('text', '8-)')">

Don't forget to insert the JavaScript library (in the head section):

<script type="text/javascript" src="http://lib.adamh.cz/smilies/smilies.js"></script>

License

© 2008 Adam Heinrich

Licensed under GNU General Public License

Download

Source code and example: lib.adamh.cz/smilies