COOKIE脚本记录有什么用?

来源:百度知道 编辑:UC知道 时间:2024/05/25 02:06:32
我是制作网页的菜鸟!我在网上看到说:“COOKIE脚本记录,有很大的用处哦”,但我唔知有什么用?

并且以下这个代码有什么用?

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (documents.cookie.length > 0) {
offset = documents.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = documents.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = documents.cookie.length;
returnvalue=unescape(documents.cookie.substring(offset, end))
}
}
return returnvalue;
}

function loadpopup(){
if (get_cookie(';popped';)==';';){
openpopup()
documents.cookie="popped=yes"
}
}

COOKIE 保存在 客户端 里的数据。
为什么不好,简直是好"急"了!

有了他………………不知道怎么说。
就比如这里吧,如果我点提交回答,但是却因为网络原因,回答失败了。
那我以前打的字怎么办?如果保存在COOKIE,再增加一个发贴记录
那就好办多了。而且是保存在 客户端 里的。服务器又不担心负载。多棒!

再比如,我登陆了,我下次不希望输入密码,
那怎么做啊,如果在 客户端 保存一个 COOKIE,有他个20位或更多位的随机数字,就知道这是哪个用户在用了。因为位数多,你也可以用其他软件来猜,但是几率太低了```