2012-12-26 30 views
-1

我使用Razor v2模板引擎從WPF呈現HTML頁面,但從模板中的JavaScript獲取錯誤。有問題的代碼如下:Razor模板的JavaScript錯誤

13 <script type="text/javascript"> 
14  var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false; 
15  if(!ie7){ 
16   WebFontConfig = { 
17    google: { families: [ 'Droid Serif', 'Droid Sans', 'Satisfy', 'PT Sans' ] } 
18   }; 
19  (function() { 
20   var wf = document.createElement('script'); 
21   wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + 
22   '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'; 
23   wf.type = 'text/javascript'; 
24   wf.async = 'true'; 
25   var s = document.getElementsByTagName('script')[0]; 
26   s.parentNode.insertBefore(wf, s); 
27   })(); 
28  } 
29  </script> 

的錯誤是:

{c:\Users\Echilon\AppData\Local\Temp\0sdz13xb.0.cs(15,28) : error CS1002: ; expected} 

我已經試過包裝在<text>標籤的腳本部分無濟於事。

回答