//提取cookie中的值 CloudShareCommon.prototype.getCookie = function (name) { var cookieStr = document.cookie; if (cookieStr.length > 0) { var cookieArr = cookieStr.split(";"); //将cookie信息转换成数组 for (var i = 0; i < cookieArr.length; i++) { var cookieVal = cookieArr[i].split("="); //将每一组cookie(cookie名和值)也转换成数组 if (cookieVal[0] == name) { return unescape(cookieVal[1]); //返回需要提取的cookie值 } } } }
转载于:https://www.cnblogs.com/queende7/p/8669037.html