日期:2014-05-16 浏览次数:20363 次
写入cookie实例!
var u = "value=123"; document.cookie = u;
var c_name="value"; // 变量名 if (document.cookie.length > 0) { c_start = document.cookie.indexOf(c_name + "=") if (c_start != -1) { c_start = c_start + c_name.length + 1 c_end = document.cookie.indexOf(";", c_start) if (c_end == -1) c_end = document.cookie.length // document.write(document.cookie.substring(c_start,c_end)+"<br>"); var sss= unescape(document.cookie.substring(c_start, c_end)) // 取出值 alert(sss) } }