日期:2014-05-16 浏览次数:20461 次
<script language="javascript" type="text/javascript"> function setCookie(name,value) { var Days = 1; var exp = new Date(); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); } function getCookie(name) { var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)) return unescape(arr[2]); else return ""; } function setURL(productId){ // if(!(getCookie("test").indexOf(productId)>0)){ if(getCookie("test")!="") setCookie("test",getCookie("test") + "|" + productId); else setCookie("test",productId); } n con; } //初始化s
<script language="javascript" type="text/javascript"> function setCookie(name,value) { var num = getCookie("COUNTER"); if(!num){ num=0; } if(num>=3){ alert("FULL"); return; } re
------解决方案--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>myvicy view history</title> <script language="javascript" type="text/javascript"> function setCookie(name, value) //cookies设置 { var argv = setCookie.arguments; var argc = setCookie.arguments.length; var expires = (argc > 2) ? argv[2] : 1; if(expires!=null&&expires!="") { var LargeExpDate = new Date (); LargeExpDate.setTime(LargeExpDate.getTime() + (expires*1000*3600*24)); } document.cookie = name + "=" + escape (value)+((expires == null) ? "" : ("; expires=" +LargeExpDate.toGMTString())); } function getCookie(name) //cookies读取 {