根据Cookie的key值获取value值: function getCookie(key){ var arr,reg=new RegExp("(^| )"+key+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)) return unescape(arr[2]); else return ""; }