Site hosted by Angelfire.com: Build your free website today!
This code gives you the popup you saw and will count the number of times a visitor has been to your page. It will give a different message for each of the first ten visits but will keep counting indefinetly. One on my page has counted over 50 visits by my browser in the time I've had this code on the page. It just happens to be a page I use to check my guestbook but it gave me a good chance to see how well this script works

Too use it you type this script into your head.

So here it is:

<HEAD> <SCRIPT LANGUAGE="JavaScript"> <!--hiding //************************************************************************** // THIS WAS highly modified BY unixdown // http://homepage.dave-world.net/~zweber/unix.html // zweber@mail.dave-world.net // Please give me credit for this script //************************************************************************** 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)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function SetCookie (name, value)
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? 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 to diplay info
// by unixdown (zweber@mail.dave-world.net)
function DisplayInfo()
{
var expdate = new Date();
var visit;
// Set expiration date to a year from now.
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
if(!(visit = GetCookie("visit")))
visit = 0;
visit++;
SetCookie("visit", visit, expdate, "/", null,
false);
var message;
if(visit == 1)
message=" Welcome to this cool page";
if(visit== 2)
message=" hello again";
if(visit == 3)
message=" pretty cool page isn't it!"; if(visit == 4)
message=" You must be still looking!"; if(visit == 5)
message=" Did you sign the Guestbook yet?!"; if(visit == 6)
message=" got a lot of time?!";
if(visit == 7)
message=" Nothing better to do?";
if(visit == 8)
message=" Don't you ever sleep?";
if(visit == 9)
message=" Keep coming back,
that's why I'm here!!!";
if(visit >= 10)
message=" Is this place so good that you must come back so many times!?!";
alert("\n"+"Your browser has visited this page
\n"
+"
"+visit+"\n"
+"
times."+"\n"+"\n"
+message);
}
//end hiding-->
</Script>
</HEAD>


Then add this onLoad to your body tag;
<BODY onLoad=DisplayInfo()>


That's all