Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Javascript double quote escape character?

Reply
Thread Tools

Javascript double quote escape character?

 
 
Alden Streeter
Guest
Posts: n/a
 
      11-24-2003
Here is the HTML that is being output by my asp page:

<a href='Files/category/computers/bigimages/computers-sub-monitors.jpg'
target='_blank' onMouseOver="window.status='Click for a larger image of
MONITOR, 19\" CODAR EAGLE.';return true;"
onMouseOut="window.status='';return true;">
<img width='98' height='96' border='0'
src='Files/category/computers/bigimages/computers-sub-monitors.jpg'
alt='MONITOR, 19" CODAR EAGLE'></a>

Notice the \" . AFAIK this escape character is what I am supposed to do to
use a double quote in a string in javascript. But my browser (IE 6.0)
doesn't like it - it says it is an "unterminated string constant".

If I change the double quote to a single quote - \' - then the browser works
as expected: it shows 19' in the status bar. But the monitor I am
describing is really only 19 inches, not 19 feet, so that's not a real
option.

So am I using the escape character wrong, or have I just run into a bug in
IE6?


 
Reply With Quote
 
 
 
 
Alden Streeter
Guest
Posts: n/a
 
      11-26-2003
"Peter Foti" <> wrote in message
news:...
> "Alden Streeter" <astreeter_no_spam_@srca.net> wrote in message
> news:...
> > Here is the HTML that is being output by my asp page:
> >
> > <a href='Files/category/computers/bigimages/computers-sub-monitors.jpg'
> > target='_blank' onMouseOver="window.status='Click for a larger image of
> > MONITOR, 19\" CODAR EAGLE.';return true;"
> > onMouseOut="window.status='';return true;">
> > <img width='98' height='96' border='0'
> > src='Files/category/computers/bigimages/computers-sub-monitors.jpg'
> > alt='MONITOR, 19" CODAR EAGLE'></a>
> >
> > Notice the \" . AFAIK this escape character is what I am supposed to do

> to
> > use a double quote in a string in javascript. But my browser (IE 6.0)
> > doesn't like it - it says it is an "unterminated string constant".
> >
> > If I change the double quote to a single quote - \' - then the browser

> works
> > as expected: it shows 19' in the status bar. But the monitor I am
> > describing is really only 19 inches, not 19 feet, so that's not a real
> > option.
> >
> > So am I using the escape character wrong, or have I just run into a bug

in
> > IE6?

>
> You are using the escape character wrong. This is not a bug. You need to
> use &quot; instead. As in:
>
> ...
> MONITOR, 19&quot; CODAR EAGLE';return true;"
>
> See this portion of the HTML spec for more info on this:
> http://www.w3.org/TR/html4/appendix/...html#h-B.3.2.1
>
> Regards,
> Peter Foti


Thanks! That works without the hack. I knew it couldn't have been a bug in
IE


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with single-quote and double-quote when using subprocess. Evan Python 3 11-04-2008 12:24 PM
How to handling string contains single quote and double quote vikrant Perl Misc 8 05-17-2007 04:37 PM
Datagrid on load; replace all double single quote to single quote to display to user Eric Layman ASP .Net 3 04-14-2007 07:16 AM
Single Quote Versus Double Quote In A href link knee-dragger@hotmail.com HTML 3 06-13-2006 12:42 AM
single/double quote escape interpolation Simon Bunker Python 2 07-08-2003 02:15 AM



Advertisments