SoFunction
Updated on 2025-03-01

js gets the specific implementation of the specified cookie


var cookieName = "cookie name";
var cookieValue = null;//Return the value of the cookie
if ( && != '') {
var cookies = (';');//Cut all cookies obtained into an array
for (var i = 0; i < ; i++) {
var cookie = cookies[i];//Get the cookies array with a subscript
if ((0, + 2).trim() == () + "=") {//If this cookie exists, take out the value of the cookie
cookieValue = ( + 2, );
break
}
}
}
if (cookieValue != "" && cookieValue != null) {//If the specified cookie value exists
alert(cookieValue);
} else {<span style="font-family: Arial, Helvetica, sans-serif;">//If the value of the cookie is empty</span>
alert("not cookie!!!");
}