未捕获的SyntaxError:意外的令牌{

时间:2013-01-21 17:47:30

标签: javascript jquery html5

(cdn_url = "", LazyLoad.js("maps/map0.js" {maps_loaded[0] = true}))

它一直在说Uncaught SyntaxError: Unexpected token {

现在说它缺少[

整行:

if (("" == window.location.port || "80" == window.location.port) && !/\/wiki/.test(window.location.pathname)) window.location = window.location.protocol + "//" + window.location.hostname + ":" + config.http_port + window.location.pathname;
var map = [],
    on_map = [],
    maps_loaded = {}, cdn_url = "localhost";
"80" != window.location.port ? (cdn_url = "", LazyLoad.js("maps/map0.js", {
    maps_loaded[0] = true
})) {
    maps_loaded[0] = true
})) : LazyLoad.js(cdn_url + "maps/map0.js?" + map_hashes[0], function () {
    maps_loaded[0] = true
});

2 个答案:

答案 0 :(得分:4)

您之后是否需要逗号:

"maps/map0.js"

之前:

{maps_loaded[0]=true}

答案 1 :(得分:2)

形成我所看到的 - 在第一个参数传递给LazyLoad.js函数后,您将失去昏迷 - >它应该是(cdn_url =“”,LazyLoad.js(“maps / map0.js”,{maps_loaded [0] = true}))