最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Says "Expecting more source characters" - Stack Overflow

programmeradmin1浏览0评论

That code below gives an error "Expecting more source characters" you may please any help me on this issue.

Thanks

Cengiz Yücel A web developer form Turkey

 <script type="text/javascript">
        $(document).ready(function () {
            $("a#aDevam").hover(function () {
                $("div#SekmeBtn").css({ 'background-image': 'url(images/SekmeButonDevam.jpg)'
                });
            }, function () {
                var cssObj = { 'background-color': '#ddd' }
                $("div#AA").css(cssObj);
            });
 </script>

That code below gives an error "Expecting more source characters" you may please any help me on this issue.

Thanks

Cengiz Yücel A web developer form Turkey

 <script type="text/javascript">
        $(document).ready(function () {
            $("a#aDevam").hover(function () {
                $("div#SekmeBtn").css({ 'background-image': 'url(images/SekmeButonDevam.jpg)'
                });
            }, function () {
                var cssObj = { 'background-color': '#ddd' }
                $("div#AA").css(cssObj);
            });
 </script>
Share Improve this question edited Feb 18, 2011 at 9:25 user241244 asked Feb 18, 2011 at 9:15 Cengiz YücelCengiz Yücel 11 silver badge1 bronze badge 0
Add a ment  | 

3 Answers 3

Reset to default 5

"Expecting more source characters" normally indicates a line that's not terminated and there is one.

var cssObj = { 'background-color': '#ddd' }

needs a semicolon.

check unclosed braces or missed semicolon inside your java script snippet. I got this error whenever I missed a closing brace for a function inside the 'script' tag.

Another mon source that catches C programmers is the opening brace on functions -- (most) javascript programmers put it at the end of the line and (most) C programmers start it on a new line. Doing both is obviously an error:

MyClass.LastFunctionInFile = function() {
{
    Foo();
    Bar();
}

See it?

发布评论

评论列表(0)

  1. 暂无评论