Adding Smilies Option

Just Adding Smilies Option on Comment at
just doit simple! paste this code to the file comments.php above <textarea> … </texarea>

<!-- smilies -->
<script type="text/javascript">function grin(tag) {
var myField;
if (document.getElementById('content') && document.getElementById('content').type == 'textarea') {
myField = document.getElementById('content');
else if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
myField = document.getElementById('comment');
else {
return false;
if (document.selection) {
sel = document.selection.createRange();
sel.text = tag;
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var cursorPos = endPos;
myField.value = myField.value.substring(0, startPos)
+ tag
+ myField.value.substring(endPos, myField.value.length);
cursorPos += tag.length;
myField.selectionStart = cursorPos;
myField.selectionEnd = cursorPos;
else {
myField.value += tag;

<img xsrc="" alt=":mrgreen:" onclick="grin(':mrgreen:');"/>
<img xsrc="" alt=":neutral:" onclick="grin(':neutral:');"/>
<img xsrc="" alt=":twisted:" onclick="grin(':twisted:');"/>
<img xsrc="" alt=":shock:" onclick="grin(':shock:');"/>
<img xsrc="" alt=":smile:" onclick="grin(':smile:');"/>
<img xsrc="" alt=":???:" onclick="grin(':???:');"/>
<img xsrc="" alt=":cool:" onclick="grin(':cool:');"/>
<img xsrc="" alt=":evil:" onclick="grin(':evil:');"/>
<img xsrc="" alt=":grin:" onclick="grin(':grin:');"/>
<img xsrc="" alt=":oops:" onclick="grin(':oops:');"/>
<img xsrc="" alt=":razz:" onclick="grin(':razz:');"/>
<img xsrc="" alt=":roll:" onclick="grin(':roll:');"/>
<img xsrc="" alt=":wink:" onclick="grin(':wink:');"/>
<img xsrc="" alt=":cry:" onclick="grin(':cry:');"/>
<img xsrc="" alt=":eek:" onclick="grin(':eek:');"/>
<img xsrc="" alt=":lol:" onclick="grin(':lol:');"/>
<img xsrc="" alt=":mad:" onclick="grin(':mad:');"/>
<img xsrc="" alt=":sad:" onclick="grin(':sad:');"/>
<br />
<!-- -->

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:


You are commenting using your account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )


Connecting to %s