开发者

concatenating string in classic asp

I am tr开发者_如何学Pythonying 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/>")


You have to double up the quotes:

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


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/>


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜