如何使用 '@' 在我的脚本代码符号中的MVC页面(剃刀引擎)
写这样的代码:
<script>
var a = "this is a test text with @ symbol";
alert(a);
</script>
如何使用 '@' 在我的脚本代码符号中的MVC页面(剃刀引擎)
写这样的代码:
<script>
var a = "this is a test text with @ symbol";
alert(a);
</script>
您可以使用两个ampersat符号进行转义:@@
。
var a = "this is a test text with @@ symbol";
顺便说一句,虽然我最近才知道,并认为这些过这个问题,未来还可能会发现它有用:
@*this would comment out some code, or just allow for comments in general*@
@@
应该工作以逃避字符
var a = "this is a test text with "+<text>@</text>+" symbol";
为了逃避一个@
符号,你需要像这样翻倍:
@@
THX jrummell,我会尝试使用代码语法nex时间! – 2012-04-03 14:57:55