未捕获的SyntaxError:Chrome中的意外标识符

我在页面中有以下脚本来突出显示地图。

 function highlight(list,win,lose) { var WinParty = win; var LoseParty = lose; var jsVariable = list; var area = document.getElementsByTagName('area') var ary=[] for (var zxc0=0;zxc0<area.length;zxc0++){ ary.push(area); } var isfound = false; for(var i = 0; i < area.length; i++) { isfound = false; for(var j = 0; j < jsVariable.length; j++) { if (area[i].getAttribute('title').trim() == jsVariable[j].trim()) { isfound = true; $(area[i]).each(function ()//get all areas { $(this).addClass("victory"); }); } } if(!isfound) { $(area[i]).each(function ()//get all areas { $(this).addClass("lose"); }); } } $(function () { var data = {}; $('.map').maphilight(); data.alwaysOn = true; data.fillColor = WinParty; $('.victory').data('maphilight', data).trigger('alwaysOn.maphilight'); var data = {}; $('.map').maphilight(); data.alwaysOn = true; data.fillColor = LoseParty; $('.lose').data('maphilight', data).trigger('alwaysOn.maphilight'); }); }  

我从Code Behind(VB.Net)调用此脚本如下所示

 Dim Serializer = New System.Web.Script.Serialization.JavaScriptSerializer() Dim List = Serializer.Serialize(Values) WinPartyColor = Hex(Color.Blue.ToArgb()).Substring(2) LosePartyColor = Hex(Color.Red.ToArgb()).Substring(2) Dim Script As String = String.Format("highlight({0},{1},{2});", List, WinPartyColor, LosePartyColor) ScriptManager.RegisterStartupScript(ElectionResultUpdatePanel, ElectionResultUpdatePanel.GetType(), "HighLighting", Script, True) 

当我在Chrome上运行代码时,我会收到错误

 Uncaught SyntaxError: Unexpected identifier 

但是当我在IE中运行相同的代码时,会得到错误

 SCRIPT1007: Expected ']'. 

我的猜测是关于List参数,它是Javascript中的数组。

请帮帮我。

最后我解决了这个问题,

它是从Code调用脚本的原因:

 Dim Script As String = String.Format("highlight({0},{1},{2});", List, WinPartyColor, LosePartyColor) 

我有改变如下,现在它工作正常。

 Dim Script As String = "highlight(" + List + ",'" + WinPartyColor + "','" + LosePartyColor + "');"