//创建一个Cookie
function writeCookie()
{
var destoryTime = new Date();
destoryTime.setTime(destoryTime.getTime()+24*3600*1000);
var expireTime = destoryTime.toGMTString();
document.cookie = "vistited=true"+";expires="+expireTime+";";
document.write("<div id='tip'>欢迎首次光临sky论坛,5秒之后您返回论坛首页。。</div>");
setTimeout("backToMainPage()",5000);
}
function backToMainPage()
{
window.loaction.href = "http://bbs.blueidea.com/";
}
var isCookieExist;
IsCookieExist = doucment.cookie.length;
if(!isCookieExist)
writeCookie();
else
{
var cookieContent = document.cookie;
var checkStatus = "visited=";
var startIndex = cookieContent.indexOf(checkStatus);
if(startIndex !=-1)
{
startIndex += checkStatus.length;
var endIndex = cookieContent.indexOf(",",startIndex);
if(endIndex ==-1)
endIndex = cookieContent.length;
var result = unescape(cookieContent.substring(startIndex,endIndex));
if(result != "true")
writeCookie();
else
document.write("<div id='tip'>欢迎再次来到本论坛</div>")
}else
writeCookie();
}
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛