cookie存取信息

//设置cookie
function setCookie(name,value){
    document.cookie = name + "="+ escape (value) + ";"
}

//获取cookie
function getCookie(name){
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
    if(arr=document.cookie.match(reg))
        return unescape(arr[2]).split(",");
    else
        return null;
}

具体用法:

 var hotLine = $.trim($("#hotLine").val());
 setCookie("hotLine",hotLine);
 var hotLine = getCookie("hotLine")[0];