var now = new Date(); if(GetCookieNS('clientno')==null) { var strValue=200711271243; operaCookie(strValue); document.write(""); document.write(""); } else { document.write(""); document.write(""); } function getCookieVal(offset){ var endstr = document.cookie.indexOf(";",offset); if(endstr==-1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset,endstr)); } function GetCookieNS(name){ var arg = name+"="; var alen = arg.length; var clen = document.cookie.length; var i= 0; while(i2)?argv[2]:null; var path = (argc>3)?argv[3]:null; var domain = (argc>4)?argv[4]:null; var secure = (argc>5)?argv[5]:false; document.cookie = name+"="+escape(value)+ ((expires==null)?"":(";expires="+ expires.toGMTString()))+ ((path==null)?"":(";path="+path))+ ((domain==null)?"":(";domain="+domain))+ ((secure==true)?";secure":""); } function DeleteCookie(name){ var exp = new Date(); exp.setTime(exp.getTime()-1); var cval = GetCookieNS(name); document.cookie = name+"="+cval+";expires="+exp.toGMTString(); } //Input iDate 是以天計數,設置過期的天數 //Outout 返回毫秒數 function setExpireDate(iDate) { return parseInt(iDate)*24*60*60*1000; } //如果cookie是空可以給cookie設置初使值. //返回當前cookie的值 function initCookie(initValue){ if(GetCookieNS("clientno")==null){ var expiryDate = new Date(); expiryDate.setTime(expiryDate.getTime()+setExpireDate("365")); SetCookie("clientno",initValue,expiryDate,"/"); } return GetCookieNS("clientno"); } function operaCookie(strValue){ var expiryDate = new Date(); expiryDate.setTime(expiryDate.getTime()+setExpireDate("365")); SetCookie("clientno",strValue,expiryDate,"/"); }