function getValue(key){ var search = location.search.slice(1); //得到get方式提交的查询字符串 var arr = search.split("&"); for (var i = 0; i < arr.length; i++) { var ar = arr[i].split("="); if (ar[0] == key) { return ar[1]; } } } function setCookie(c_name,value,expiredays){ var date = new Date(); date.setTime(date.getTime() + expiredays); var expires = "; expires="+date.toGMTString(); var path = "; path=/"; document.cookie = c_name+"="+value+expires+path; } function getCookie(name){ var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); if (arr = document.cookie.match(reg)) return (arr[2]); else return ''; };