Premise:
Getting cook in js is the most painful thing, because it does not save the value of the cook variable one by one, but all the variables exist together, and you can only get a certain cook by taking out the fields one by one. value.
So write a function to get the value of a certain variable:
function get_cookie(name) { var bikky = document.cookie; name += "="; var i = 0; while (i < bikky.length) { var offset = i + name.length; if (bikky.substring(i, offset) == name) { var endstr = bikky.indexOf(";", offset); if (endstr == -1) endstr = bikky.length; return unescape(bikky.substring(offset, endstr)); } i = bikky.indexOf(" ", i) + 1; if (i == 0) break; } return null; }
Got it, tested it myself, and it’s usable.