PDA

View Full Version : Smile Slash js problem :\


Crazy Squirrel
Wed 18th Jun '03, 7:42am
Had a smilie that was :\
Never had a problem with it before on vB2, but now it doesn't work properly in the javascript popup smilie window.

New Post -> Show All Smilies:
A Runtime Error has occured.
Line: 320
Error: Unterminated string constant

Starting from line 320:
<td class="alt2"><a href="#" onclick="opener.smilie(':hide:');"><img src="images/smilies/submitted/squirrel/bcomputer.gif" border="0" alt="Hide behind computer" /></a></td>
<td class="alt2">:hide:</td> <td class="alt2"><a href="#" onclick="opener.smilie(':\');"><img src="images/smilies/submitted/smark/ohwell.gif" border="0" alt="Oh Well" /></a></td>
<td class="alt2">:\</td>

The smilies all display in the box, are all clickable(insertable) except :\, clicking :\ acts like a home key - jumps to the top of the smilie box - and does not insert the smilie.

Changing the smilie code from :\ to something without slashes eliminated the problem. I believe there must be something missing in the produced javascript to stop the slash acting as a special character?

Using IE 6.0.2800.1106.xpsp2.021108-1929 btw.

Faruk
Wed 18th Jun '03, 8:18am
Starting from line 320:
<td class="alt2"><a href="#" onclick="opener.smilie(':\');"><img src="images/smilies/submitted/smark/ohwell.gif" border="0" alt="Oh Well" /></a></td>

As you can see there, the :\-smilie backslashes (escapes) the ' from the javascript, which will produce an error.

AFAIK, it can be fixed by putting an addslashes on the smilie codes before tossing them in the javascript field. (then it'll be "opener.smilie(':\\');" though I wonder if that'll put the correct stuff inside the reply textarea...).