0
 ScriptManager.RegisterStartupScript(Page, this.GetType(), "jscript", "alert('This browser is currently not supported on the website. Please use either latest version of Chrome or Mozilla Firefox. Click here to download<a href='~/CheckBrowser.aspx'>Download</a>');", true);


alert('This browser is currently not supported on the website. Please use either latest version of Chrome or Mozilla Firefox. Click here to download<a href='~/CheckBrowser.aspx'>Download</a>');(function() {var fn = function() {$get("ctl08_HiddenField").value = '';Sys.Application.remove_init(fn);};Sys.Application.add_init(fn);})();//]]>


**JavaScript critical error at line 135, column 158 in http://localhost:31424/Default.aspx  SCRIPT1006: Expected ')'**

我收到此错误无法弄清楚错误是什么

4

2 回答 2

1

你需要像这样转义引用:

ScriptManager.RegisterStartupScript(Page, this.GetType(), "jscript", "alert('This browser is currently not supported on the website. Please use either latest version of Chrome or Mozilla Firefox. Click here to download<a href=\'~/CheckBrowser.aspx\'>Download</a>');", true);


alert('This browser is currently not supported on the website. Please use either latest version of Chrome or Mozilla Firefox. Click here to download<a href=\'~/CheckBrowser.aspx\'>Download</a>');(function() {var fn = function() {$get("ctl08_HiddenField").value = '';Sys.Application.remove_init(fn);};Sys.Application.add_init(fn);})();//]]>
于 2013-05-21T08:26:15.347 回答
0

尝试这个:

ScriptManager.RegisterStartupScript(Page, this.GetType(), "jscript", "alert('This browser is currently not supported on the website. Please use either latest version of Chrome or Mozilla Firefox. Click here to download<a href=\'~/CheckBrowser.aspx\'>Download</a>');", true);
于 2013-05-21T08:26:08.120 回答