Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在MVC4中使用字符串中的@class_Javascript_Asp.net Mvc_Asp.net Mvc 4_Razor_Yql - Fatal编程技术网

Javascript 如何在MVC4中使用字符串中的@class

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

我有一个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 = 'select * from html where url=\"www.yahoo.com\" and xpath=\'\//div[contains(\'@class,\"techSpecsTable/\")]\' '

您不需要转义
@class
,您需要转义的是
@class
之前的撇号。