foreach (var item in products)
{
contantProduct += "<br/> <div class='linkProduct' id=\"link" + item.IdProduct + "\" onclick=\"$('.linkFlashIco').css('background-image','url(icon/Pointer.png)');$(this).find('>:first-child').css('background-image','url(icon/Activepointer.png)'); $(this).find('>:first-child').css('background-repeat','no-repeat'); $('.linkProduct').css('font-weight','normal');$('.linkProduct').css('border','1px solid orange');$('.linkProduct').css('background-color','white');$(this).css('border','1px solid blue');$(this).css('background-color','red');$(this).css('font-weight','bold');$('.detailProduct').slideUp();$(\'#" + item.IdProduct + "\').slideToggle('normal');\" id=\"link" + item.IdProduct + "\" style='text-align: right;cursor: pointer;float: right;padding-right: 2px;border:1px solid orange;text-decoration:none' > 开发者_运维技巧<font face='Tahoma'>" + item.NameProduct + "</font><div class='linkFlashIco' style='background-image: url(icon/Pointer.png); background-repeat: no-repeat;float: right;width: 18px;height: 20px;'></div></div>";
}
how can write contantProduct
in multi line
i like write
contantProduct+="<br/><div"
+"....."
+"...."
use the @
contantProduct += @"
<br/>
<div class='linkProduct' id=""link""
... etc. ";
If I understand what you're getting at, you can find some answers here.... Multiline strings in Javascript
You could use ejs or http://jade-lang.com/ as a templating engine. JavaScript doesn't natively support multiline strings unless you want to escape the line breaks.
var str = "some text \
Some more text";
精彩评论