itsaboutcode
itsaboutcode

Reputation: 25099

concatenating string in classic asp

I am trying to concatenate image url (string) with img tag but i am not sure how to put " after src=. Please help to concatenate this.

response.write("<img src=" & '"' & rs("ProductImage") & '"' &" /><br/>")

Upvotes: 8

Views: 41377

Answers (3)

burn0050
burn0050

Reputation: 406

Another option is to use the chr function:

Response.Write("<img src=" & chr(34) & rs("ProductImage") & chr(34) & " /><br/>")

ascii code 34 is the double quote. We use this all the time when writing out HTML.

Upvotes: 1

slolife
slolife

Reputation: 19870

Since HTML can use double quotes or single quotes, why not just use single quotes for the HTML. So your code would look like this:

response.write("<img src='" & rs("ProductImage") & "' /><br/>")

The resulting output would look like this:

<img src='ProductImageUrl' /><br/>

Upvotes: 3

Thomas
Thomas

Reputation: 64645

You have to double up the quotes:

Response.Write("<img src=""" & rs("ProductImage") & """ /><br/>")

Upvotes: 12

Related Questions