I use the JS script from: coursesweb.net/javascript/texarea-buttons-format-text-colors-smiles_s2
I changed the first one & added a 10th item:
Code: Select all
<img src="icos/0.gif" alt=":bb" title=":bb" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
<img src="icos/1.gif" alt=":(" title=":(" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
<img src="icos/2.gif" alt=":P" title=":P" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
<img src="icos/3.gif" alt=":D" title=":D" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
<img src="icos/4.gif" alt=":S" title=":S" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
<img src="icos/5.gif" alt=":O" title=":O" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
<img src="icos/6.gif" alt=":=)" title=":=)" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
<img src="icos/7.gif" alt=":|H" title=":|H" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
<img src="icos/8.gif" alt=":X" title=":X" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
<img src="icos/9.gif" alt=":-*" title=":-*" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
<img src="icos/10.gif" alt=":b" title=":b" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
Code: Select all
// Add code for clicked smile in element with ID passed in "id_txtfield"
function addSmile(smile) {
// object with characters that represent the smiles, and the name of the GIF file for each one
var smchr = {':bb':0, ':(':1, ':P':2, ':D':3, ':S':4, ':O':5, ':=)':6, ':|H':7, ':X':8, ':-*':9, ':b':10}
Code: Select all
<img src="icos/undefined.gif" />