未捕获的语法错误:意外令牌非法

Uncaught SyntaxError: Unexpected token ILLEGAL

本文关键字:意外 令牌 非法 错误 语法      更新时间:2023-09-26

我正在将我的javascript归档到外部文件。 在此过程中,我在Chrome中遇到了以下错误:

未捕获的语法错误:意外令牌非法行:2

$(document).bgStretcher({
#if($CURRENTPAGE.pageId==23)
    images: ['/media/backgrounds/homepage/homepage.jpg'], imageWidth: 1860, imageHeight: 1000
    #else
        images: ['/media/backgrounds/Dreamjob_coachfoto_'+pad(randomnumber,3)+'.jpg'], imageWidth: 1860, imageHeight: 1000
    #end
    });

谁能帮我?

正确的语法(图像的语法看起来很奇怪,但我找不到 bgstretcher 的完整文档抱歉)

$(document).bgStretcher({
if($CURRENTPAGE.pageId==23) {
images: ['/media/backgrounds/homepage/homepage.jpg'], imageWidth: 1860, imageHeight: 1000
}  
 else   {
    images: ['/media/backgrounds/Dreamjob_coachfoto_'+pad(randomnumber,3)+'.jpg'],              imageWidth: 1860, imageHeight: 1000
 }
});
使用

Firefox 调试(使用 Firebug),它会为您提供比 Chrome 更多关于此类错误的信息。