I am working with it for an hour but I can't figure out what is wrong in that.
<html>
<body>
<input type="button" value="set" onclick=setcook()>
<input type="button" value="get" onclick=getcook()>
<script>
function setcook() {
document.cookie = "un=nu";
}
function getcook() {
if (document.cookie.length != 0)
alert(document.cookie);
else {
alert("cookie not available");
}
}
</script>
</body>
</html>
使用这个方法..希望它会帮助你
Cookies.set('key',value);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.