求javascript中的创建cookes的详细教程

来源:百度知道 编辑:UC知道 时间:2024/06/23 01:11:03
是cookes的详细教程
请附上详细解说,或者给个教程地址也行。谢谢。加分
--------------------------------------------------------------
2楼的能不能再详细点,那个网站我知道,只有一个例子,没有解说。
再详细解说一下,最多200分都能给你。谢谢!!

//设定cookie值
function setCookie(name, value, domain) {
document.cookie = "[" + name + "]=" + escape(value) +";path=/"+ ((domain)?";domain="+domain:"") // + ((expire == null) ? "" : ("; expires=" + expire.toGMTString())) +";secure"
}//:$

//读取cookie值
function getCookie(Name) {
var search = "[" + Name + "]="
if (document.cookie.length > 0) { // if there are any cookies
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset)
// set index of end of cookie value
if (en