cookie|初学
<html>
<head>
<title>Homepage</title>
</head>
<body>
<a href='http://www.thehungersite.com/'>Manual redirection
</a>
<a href="javascript:ResetCookie()">Cookie reset</a>
<script language="">
<!--
var bVisitedToday = false;
var lastVisit = GetCookie("lastVisit");
if (lastVisit != null)
{
lastVisit = 1 * lastVisit;
var lastHere = new Date(lastVisit);
var rightNow = new Date();
if(lastHere.getYear() == rightNow.getYear()
&& lastHere.getMonth() == rightNow.getMonth()
&& lastHere.getDate() == rightNow.getDate())
{
bVisitedToday = true;
}
}
if(bVisitedToday == false)
{
setLastlastVisitCookie();
window.location="http://www.thehungersite.com/"
}
else
{
//window.location="about:blank"
}
function getCookieVal (offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name)