-3

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

Uncaught SyntaxError: Unexpected token ILLEGAL Line: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
    });

谁能帮我?

4

2 回答 2

0

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

于 2014-03-07T11:05:25.227 回答
0

正确的语法(图像上的语法看起来很奇怪,但我找不到 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
 }
});
于 2013-09-23T14:57:53.217 回答