Javascript 如何在MVC4中使用字符串中的@class
我有一个MVC4 Razor应用程序,需要在包含@class的javascript部分中构造一个字符串。我怎样才能在字符串中使用它呢Javascript 如何在MVC4中使用字符串中的@class,javascript,asp.net-mvc,asp.net-mvc-4,razor,yql,Javascript,Asp.net Mvc,Asp.net Mvc 4,Razor,Yql,我有一个MVC4 Razor应用程序,需要在包含@class的javascript部分中构造一个字符串。我怎样才能在字符串中使用它呢 var S = 'select * from html where url=\"www.yahoo.com\" and xpath=\'\//div[contains('@class,\"techSpecsTable/\")]\' ' 如何逃出@class?您可以通过执行以下操作逃出@class @@class 但我认为你需要把这个 var S = 'sele
var S = 'select * from html where url=\"www.yahoo.com\" and xpath=\'\//div[contains('@class,\"techSpecsTable/\")]\' '
如何逃出@class?您可以通过执行以下操作逃出@class
@@class
但我认为你需要把这个
var S = 'select * from html where url=\"www.yahoo.com\" and xpath=\'\//div[contains(\'@class,\"techSpecsTable/\")]\' '
您不需要转义
@class
,您需要转义的是@class
之前的撇号。