封装cookie获取方法一 function getCookie(key) { var key = encodeURIComponent(key); var result; var pairs = document.cookie.split('; '); var i, len, item, value; for (i = 0, len = pairs.length; i < len; ++i) { item = pairs[i]; if (item.indexOf(key) === 0) { v…