[Javascript] Using data with a single quote in a Javascript o pen

Filipiak, Bob (Contractor) filipiab at atsc.army.mil
Fri Sep 28 09:25:31 CDT 2001


There is some great help on ASP at
http://www.asplists.com/asplists/aspclient.asp

On your ASP page try concatenating the line before response.write:

Dim lineOut
lineOut = "<a href="
lineOut= lineOut & chr(34) &"#" chr(34)
lineOut= lineOut & " onClick=" & chr(34) & "javascript:window.open"
lineOut= lineOut & "('radiopopupgenerator.htm?MP3="
lineOut= lineOut & Server.HTMLEncode(rs.Fields("FileName").Value)
lineOut= lineOut & "&title="
lineOut= lineOut & Server.HTMLEncode(rs.Fields("StoryName").Value)
lineOut= lineOut &
"','Audio','width=240,height=190,location=no,menubar=no,scrollbars=no,status
=no,toolbar=no,resizable=yes');"
lineOut= lineOut & chr(34) & ">"

response.write lineOut

Bob Filipiak
(Contractor)


-----Original Message-----
From: David Chance [mailto:david_chance at yahoo.com.au]
Sent: Friday, September 28, 2001 12:00 AM
To: javascript at LaTech.edu
Subject: [Javascript] Using data with a single quote in a Javascript
open


How can I use data with a single quote in a Javascript open
window statement??

I'm retreiving data from Access using asp, and I'm then using an
on click window.open to open a window that loads up RealPlayer
content:

<a href="#"
onClick="javascript:window.open('radiopopupgenerator.htm?MP3=<%=Server.HTMLE
ncode(rs.Fields("FileName").Value)%>&title=<%=Server.HTMLEncode(rs.Fields("S
toryName").Value)%>','Audio','width=240,height=190,location=no,menubar=no,sc
rollbars=no,status=no,toolbar=no,resizable=yes');">

The problem happens when some of my data has single quotes in
it. The page chokes.

I'm assuming I need to be place the recordset value in a
variable and parse for the ' and add a second one to it, but I'm
having problems doing this.

Any ideas??

Thanks a lot!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010928/4aead3e4/attachment.htm>


More information about the Javascript mailing list