为什么我收到错误“SyntaxError:illegal character”

时间:2013-09-10 10:59:50

标签: javascript jquery illegal-characters

如果我使用line:

var colorsone = ["#F0F8FF", "#FAEBD7", "#00FFFF", #7FFFD4", #F0FFFF","#F5F5DC", "#FFE4C4", "#000000", "#FFEBCD", "#0000FF", "#8A2BE2", "#A52A2A", "#DEB887", "#5F9EA0", "#7FFF00", "#D2691E", "#FF7F50", "#6495ED", "#FFF8DC", "#DC143C", "#00FFFF", "#00008B", "#008B8B", "#B8860B", "#A9A9A9", "#006400", "#BDB76B", "#8B008B"];

我在firebug中收到此错误

SyntaxError: illegal character
...one = ["#F0F8FF", "#FAEBD7", "#00FFFF", #7FFFD4", #F0FFFF","#F5F5DC", "#FFE4C4",...
jquery....min.js (строка 6, столбец 50)

我正在使用jquery 1.10.2

请告诉我为什么我会收到错误?

1 个答案:

答案 0 :(得分:13)

您的数组中缺少引号。

var colorsone = ["#F0F8FF", "#FAEBD7", "#00FFFF", #7FFFD4", #F0FFFF","#F5F5DC"
                                                 ^ here    ^ and here