⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cookieutil.js

📁 Portal C# Article Live
💻 JS
字号:

    function getCookieValue(name) 
      { 
        var cookieString = document.cookie; 
        var index = cookieString.indexOf(name + "="); 

        if (index == -1) return null; 

        index = cookieString.indexOf("=", index) + 1; 
        var endstr = cookieString.indexOf(";", index); 

        if (endstr == -1) endstr = cookieString.length; 

		return unescape(cookieString.substring(index, endstr));
      } 
      
      
    function setCookieValue(cookieName, cookieValue, cookiePath, cookieExpires) 
      { 
        cookieValue = escape(cookieValue); 
        if (cookieExpires == "") 
          { 
            var nowDate = new Date(); 
            nowDate.setMonth(nowDate.getMonth() + 6); 
            cookieExpires = nowDate.toGMTString();
          }

        if (cookiePath != "") 
          {
            cookiePath = ";Path=" + cookiePath; 
          } 

       document.cookie = cookieName + "=" + cookieValue + ";expires=" + cookieExpires + cookiePath;
      }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -