开发者

Weird Javascript error

开发者 https://www.devze.com 2023-03-26 23:47 出处:网络
I have a html page which has this js: <script language=\"javascript\" type=\"text/javascript\">

I have a html page which has this js:

<script language="javascript" type="text/javascript"> 
$(function() { 
        BOOKS.init({ 
    开发者_如何学JAVA            xmlPath : "http://localhost/project/books.xml", 
                imgPath : "http://localhost/project/img/", 
                perView : 6 
        }); 
)}; 
</script> 

However "$(fun" decided to disappear and become:

<script language="javascript" type="text/javascript"> 
ction() { 
        BOOKS.init({ 
                xmlPath : "http://localhost/project/books.xml", 
                imgPath : "http://localhost/project/img/", 
                perView : 6 
        }); 
)}; 
</script>

Any idea why?


Jian, You have the syntex error in your code. Your closing brace of function() is before then closing brace of $. Use the below code. I have edited it.

$(function() { 
    BOOKS.init({ 
            xmlPath : "http://localhost/project/books.xml", 
            imgPath : "http://localhost/project/img/", 
            perView : 6 
    }); 
});

Use firebug for javascript :)

0

精彩评论

暂无评论...
验证码 换一张
取 消