标签:pat split get title org new ble div w3c
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>封装cookie</title> <script> function setCookie(name,value,iDay){ var oDate=new Date(); oDate.setDate(oDate.getDate()+iDay); document.cookie=name+‘=‘+value+‘;expires=‘+oDate; } function getCookie(name){ var arr=document.cookie.split(‘; ‘); for(var i=0;i<arr.length;i++){ var arr2=arr[i].split(‘=‘); if(arr2[0]==name){ return arr2[1]; } } return ‘‘; } function removeCookie(name){ setCookie(name,1,-1); } setCookie(‘name‘,‘sdsd‘); alert(getCookie(‘name‘)); removeCookie(‘name‘); </script> </head> <body> </body> </html>
标签:pat split get title org new ble div w3c
原文地址:https://www.cnblogs.com/sunnywindycloudy/p/13021394.html