[英]string output to html formatting problem
I have the following string variables: 我有以下字符串变量:
string feedImage ="http://im.media.ft.com/m/img/rss/RSS_Default_Image.gif"
rssImageStyle = "style=\"background-image:url(\'" + feedImage + "\')\"";
I want it to output the following html 我希望它输出以下html
background-image: url('http://im.media.ft.com/m/img/rss/RSS_Default_Image.gif');
But I get 但是我明白了
background-image: url(http://im.media.ft.com/m/img/rss/RSS_Default_Image.gif);
You shouldn't escape ': 您不应该逃脱':
string feedImage ="http://im.media.ft.com/m/img/rss/RSS_Default_Image.gif"
rssImageStyle = "style=\"background-image:url('" + feedImage + "')\"";
Don't esacpe the single quotes. 不要忽略单引号。
ie \\' should be ' 即\\'应该是'
You escaped ' and there is no need to do that. 您逃脱了',并且没有必要这样做。 Try this: rssImageStyle = "style=\\"background-image:url('" + feedImage + "')\\"";
试试这个: rssImageStyle = "style=\\"background-image:url('" + feedImage + "')\\"";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.