Backslash does NOT escape Apostrophe

Giganews Newsgroups
Subject: Backslash does NOT escape Apostrophe
Posted by:  tlash…@dmacc.edu (Terry Asher)
Date: 3 Sep 2003

The following script does NOT escape the Apostrophe.
Meaning when you mouseover the image the Alt tag
says this:  DMACC, It and then it stops.

<SCRIPT Language="JavaScript">
var pos = "DMACC, It\'s the Smart Thing to Do.";
document.write("<img name=img5 id=img5 src='/homepage/dmaccstudent" +
Math.floor(Math.random() *20) +
".jpg' WIDTH=145 HEIGHT=230 border=0 ALT='"+pos+"'>");
</SCRIPT>

Please Help!  I've been struggling with
this stupid apostrophe for far too long!!!

Replies