JavaScript在http://localhost:31424/Default.aspx SCRIPT1006中的第

本文关键字:SCRIPT1006 aspx 31424 http localhost JavaScript Default | 更新日期: 2023-09-27 18:14:48

 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 ')'**

我得到这个错误不能找出错误是什么

JavaScript在http://localhost:31424/Default.aspx SCRIPT1006中的第

你需要像这样转义引号:

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);})();//]]>

试试这个:

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);