Adding smilies in Textarea for format smiles

Place for comments, problems, questions, or any issue related to the JavaScript / PHP scripts from this site.
User avatar
JanMolendijk
Posts:282
Location:Holland Rotterdam

Adding smilies in Textarea for format smiles

I`m busy with updating my comment-system, I use a option for smilies in the JS script from:
coursesweb.net/javascript/texarea-buttons-format-text-colors-smiles_s2

I add images for stickers.
But it suprice because it seems is there a max of 28 items ?

Or i can`t get number 29 & can not find the error 27 & 28 are just working.

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, ':V':11, ':A':12, ':S':13, ':Q':14, ':W':15, ':E':16, ':R':17, ':T':18, ':Y':19, ':U':20, ':I':21, ':O':22, ':FF':23, ':GG':24, ':HH':25, ':JJ':26, ':STICKERA':27, ':STICKERB':28, ':STICKERC':29}

Code: Select all

<div class="dropdown">
<button class="dropbtn">stickers</button> 
  <div class="dropdown-content">
<form name="formc" id="formc" method="post" action="script.php" style="position:relative;width:100%;text-align:center;">
 <div id="getcolor" style="display:none;margin:3px auto;background:#fff;">Colors</div>
 <div id="stickers">
 <img src="icos/27.gif" alt=":STICKERA" title=":STICKERA" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
  <img src="icos/28.gif" alt=":STICKERB" title=":STICKERB" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />
  <img src="icos/29.gif" alt=":STICKERC" title=":STICKERC" class="addsmile" style="cursor:pointer;border:none;" onclick="addSmile(this)" />

</div>

Admin Posts:805
There is no limit of 29 smiles, or other number.
Not know what is wrong, the code seems ok.
Is the problem in the page (not add the code in textarea) or from php (not render the image)?

- You can post here a link with a page where i can test.

Admin Posts:805
The problem is not from the adding smiles script but from the design of the page.
Try to make te images for stickers smallers, and see if they are displayed.

- Also, the page cannot be tested, i tryed right-click, but it not works.
- Also, there is error from php in page source:

Code: Select all

Undefined index: group in htdocs\Jan-Molendijk\User-Group-Item.php on line 16

JanMolendijk Posts:282
Thanks for the support strange but the stickers seems now working fine
I added more stickers first it was not working but few hours later it did worked.
& sorry I blocked the right-click + I still have to delete the group_id.