【发布时间】:2011-11-20 23:27:52
【问题描述】:
我正在为我的网站制作背景更改脚本。一切正常,除了应该存储所需值的 cookie。我正在使用 jQuery 1.3。 IE 8 说:'对象不支持第 47 行 char 118567432 上的此属性或方法'!?任何帮助将不胜感激。没有 cookie 的工作示例:
function images(which,image) {
if (which == 't1')image = images[0];
else if (which == 't2')image = images[1];//and etc...
}
$('html').css("background-image", image);
cookie 示例(不工作):
function images(which,image) {
if (which == 't1')image = images[0];
{$.cookie("html_img", "" + image + "", { expires: 7 });
imgCookie = $.cookie("html_img");}
else if (which == 't2')image = images[1];
{$.cookie("html_img", "" + image + "", { expires: 7 });
imgCookie = $.cookie("html_img");}
}
$('html').css("background-image", imgCookie);
【问题讨论】:
-
请补充一些信息,你有什么错误吗?为 FireFox 安装 FireBug,该插件将显示任何错误。
标签: javascript jquery cookies background