2012-08-09 61 views
1

我正在使用jQuery Cookie Plugin,并且它在所有页面上的运行都很好,除了在主页上运行该页面外,我正在敲打我的头,但没有运气。为什么jQuery Cookie Plugin不能在特定页面上工作?

我的代码如下所示:

$.cookie('CA_txtKeywords', $("#CAT_txtKeywords").val(), { expires: 7, path: '/' }); 

在Firebug它说:

遗漏的类型错误:对象功能(A,B){返回新e.fn.init(A,B,H) }有没有方法'饼干'

有人可以请指导什么是这个错误,以及如何删除它?

回答

7

您包括jQuery的在你的头上,那么你包括cookie的插件,但随后在页面的底部,你有这样的:

 <script type="text/javascript" src="http://www.google.com/jsapi"></script> 
     <script type="text/javascript"> 
    // You may specify partial version numbers, such as "1" or "1.3", with the same result. Doing so will automatically load the latest version matching that partial revision pattern 
    // (e.g. 1.3 would load 1.3.2 today and 1 would load 1.4.1). 
    google.load("jquery", "1"); 

    google.setOnLoadCallback(function() { 
    // Place init code here instead of $(document).ready() 
$(".euro").parseNumber({format:"#,###", locale:"it"}); 
$(".euro").formatNumber({format:"#,###", locale:"it"}); 

}) 
</script> 

再次加载jQuery的使用谷歌的装载机。由于您再次加载jQuery,因此直接附加到文档头部的jQuery名称空间(不是原型)的任何内容都会被删除。

因此,归根结底,为什么你在世界上加载jQuery两次?

解决方案:

删除谷歌装载机,并要求它从你家页面的页脚加载jQuery的。

0

您确定插件已加载到您的主页上吗?你看过源头吗? 你也可以检查你的firebug中的加载脚本。

+0

是的,我检查和插件加载在我的主页上,你可以看到自己... http://www.unicaimmobili.com/index_copy – user1433900 2012-08-09 11:37:12

相关问题