p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: Netscape and quotation marks

Message #1 by "Travis Nagler" <travisnagler@h...> on Tue, 04 Sep 2001 10:21:41 -0700
Single quotes are a problem if you have data that has a single quote in it
eg the name Mick O'Brien or the word isn't. Single quotes in data are more
common (in my experience) than double quotes.

David Cameron

-----Original Message-----
From: Kyle Burns [mailto:kburns@c...]
Sent: Friday, 7 September 2001 1:29 AM
To: Code Clinic
Subject: [proasp_codeclinic] Re: Netscape and quotation marks

Take a look at the string that you are building (it's easier without looking
at the method call):

"<img src=\"" & strFilePath & "\">"

it appears that you are trying to use Javascript escape characters in VB.
My best suggestion is that you use single qoutes on your attributes to
simplify this or store the qoute in a variable.  I'll demonstrate both

'Method 1 -- This is acceptable to all browsers that I know of
Response.Write "<img src='" & strFilePath & "'>"

'Method 2 -- Use this if you want double quotes
Dim vbQuote
vbQuote = Chr(34)

Response.Write "<img src=" & vbQuote & strFilePath & vbQuote & ">"

Kyle M. Burns, MCSD
ECommerce Technology Manager
Centra Credit Union

-----Original Message-----
From: subidpen@i...
Sent: Thursday, September 06, 2001 5:56 AM
To: Code Clinic
Subject: [proasp_codeclinic] Re: Netscape and quotation marks

I am either stupid, very tired or just plain silly, but niether of these 
two methods show up right in IE

<% response.write("<img src=\"" & strFilePath & "\">") %>

gives the following result after being run through server and client:
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: "<img src=\" & strFilePath &"]'
/test/guestbook.asp, line 44 

<% response.write("<img src="" & strFilePath & "">") %>

gives the following result:
<img src=" & strFilePath & ">
Can anyone answer what I am doing wrong?


  Return to Index