JS获取Cookie值

function getcookie(name) { var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)")); if (arr != null) return unescape(arr[2]); return null; }


function setcookie(name,value){var exp=new Date();exp.setTime(exp.getTime()+600*1000);document.cookie=name+"="+escape(value)+";expires="+exp.toGMTString();}

 

posted @ 2012-09-10 13:47  xyzhuzhou  阅读(169)  评论(0编辑  收藏  举报