我是引用了jquery.cookie.js,并且在ie中能成功创建和修改cookie的值。但是在火狐下,只能创建,不能修改,调用修改方法后,值还是创建时的初始值。
我的js代码:
 
if ($.cookie('compareCookie') == null) {
        cookieValue = typeName + "," + id;
        $.cookie('compareCookie', cookieValue); alert("新创建的cookie:" + $.cookie('compareCookie'));
    }
    else {
        cookieValue = $.cookie('compareCookie');
        productInfo = cookieValue.split('|');        if (productInfo.length > 0 && productInfo.length < 3) {
            cookieValue = cookieValue + "|" + typeName + "," + id; alert("大于0小于3时的cookieValue=" + cookieValue);
        }
        else if (productInfo.length == 3) {
        cookieValue = productInfo[1] + "|" + productInfo[2] + "|" + typeName + "," + id; alert("等于3时的cookieValue=" + cookieValue);
        }        $.cookie('compareCookie', cookieValue, { expires: 7, path: '/', domain: 'byecity.com'});
    }