473,396 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Javascript double quote escape character?

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?
Jul 19 '05 #1
4 21389
Alden Streeter wrote:
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?


I got it working by doing this:

<script type="text/javascript">
<!--
var msg='Click for a larger image of MONITOR, 19" CODAR EAGLE.'
-->
</script>
<a href='Files/category/computers/bigimages/computers-sub-monitors.jpg'
target='_blank'
onMouseOver="window.status=msg;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>

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2
Thanks! That worked.

I still think it is a bug in IE6 though that the double quote escape
character didn't work, because it does work with the single quote.

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:ug**************@TK2MSFTNGP09.phx.gbl...
Alden Streeter wrote:
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?


I got it working by doing this:

<script type="text/javascript">
<!--
var msg='Click for a larger image of MONITOR, 19" CODAR EAGLE.'
-->
</script>
<a href='Files/category/computers/bigimages/computers-sub-monitors.jpg'
target='_blank'
onMouseOver="window.status=msg;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>

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 19 '05 #3
"Alden Streeter" <as****************@srca.net> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
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
Jul 19 '05 #4
"Peter Foti" <pe****@systolicnetworks.com> wrote in message
news:vs************@corp.supernews.com...
"Alden Streeter" <as****************@srca.net> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
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 ;-)
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: sinister | last post by:
The examples in the online manual all seem to use double quotes, e.g. at http://us3.php.net/preg_replace Why? (The behavior is different with single quotes, and presumably simpler to...
7
by: JZ | last post by:
I hope there is someone out there that can suggest a solution to my problem. So here we go: $command="myapp.exe -P d:\mydir\mySubDir"; echo "<td><a...
5
by: Gary Mayor | last post by:
Hi, If I have the ' character within the javascript:pick command it doesn't work. Is there some sort of way of escaping these characters like in server side languages. function pick(symbol) {...
6
by: Denis | last post by:
I am trying to launch an .mdb file via javascript. I do not need to do anything but open the application. It is able to open the application but for some reason it opens and then closes. At...
5
by: Lucian Sandor | last post by:
Hello everyone, While I'm a newbie here, I a not new to google, so please don't send me back, it would be useless. First of all I have to specify I am working on a Blogger.com template, therefore...
12
by: Jeff S | last post by:
In a VB.NET code behind module, I build a string for a link that points to a JavaScript function. The two lines of code below show what is relevant. PopupLink = "javascript:PopUpWindow(" &...
10
by: korund | last post by:
We can use special characters ('\n') to add line breaks in text in JavaScript popup Alert boxes. there is also few additional special characters: \' single quote \" double quote \&...
25
by: Peter Michaux | last post by:
Hi, I'm thinking about code minimization. I can think of a few places where whitespace matters a + ++b a++ + b a - --b a-- -b when a line ends without a semi-colon in which case the new...
7
by: JohnF | last post by:
I have a function textag($expression){...} whose $expression argument is a string that can contain substrings like \alpha with one backslash or like a&b\\c&d with two backslashes. If I write...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.