| free hosting image hosting hosting reseller online album e-shop famous people | ||
![]() ![]() |
||
A cookie is used to determine how many times the visitor has accessed the page:the popup generation is not really random, but a predetermined sequence any number of popups can be used by simply adding to the URL arrays
Previous Visits Cookie Value:On the first visit, popup1 appears, and popup3 appears on exit.
All Javascript browsers which allow popups.
Now add this to your body tag:
count = document.cookie.substring(countbegin, countend);
if (count > 0)
{
return (count);
}
return ("0");
.
.
.
num = gettimes();
The popup sequencing is handled by 2 functions: enterpop() and exitpop().
This array may be expanded as required, simply by adding more elements.var newurl=new Array() newurl[0]="page1.html" newurl[1]="page2.html" newurl[2]="page3.html" newurl[3]="page4.html" newurl[4]="page5.html"
if (num == 0)
{
idx = 0
}
if (num > 0)
{
num2 = (num % newurl.length)
}
if (num2 == 0)
{
idx = newurl.length - 1
}
else
{
idx = num2 -1
}
where:
The line num2 = (num % newurl.length) does most of the work.num is the cookie value idx is the index of the URL array num2 is the processed value of the cookie newurl.length is the size of the URL array
var mylocation=newurl[idx]
var winl = (screen.width-300)/2;
var wint = (screen.height-500)/2;
settings='height=500,width=300,top='+wint+',left='+winl+',
scrollbars=0,toolbar=0,location=0,status=0,menubar=0,
resizable=0,dependent=0,copyhistory=0'
{
MyPopUp = window.open(mylocation,"",settings)
}
}
The function exitpop() works in a similar way.
Visit No.
1
2
3
4
5
6
Entry Popup
1
2
3
4
5
1
Exit Popup
3
4
5
1
2
3
the cookie counter value the page numbers of the popups loaded on entry and exit