PDA

View Full Version : Popup only once for BOTH entry and exit


gorilla1
02-16-2003, 01:25 PM
Working with a site that has a popup on entry to site and another on exit. The code below is a commonly used script to handle ensuring that the exit popup only occurs once per visit. But I can't quite make out how to modify this routine so that I could call it so that it handles both the entry poup and exit popup, so that both only occur once. Anyone have an idea?
G
<script>

/*
Fair well window launcher script
By JavaScript Kit (http://javascriptkit.com)
Over 200+ free scripts here!
*/

function openpopup(){
//configure "seeyou.htm and the window dimensions as desired
window.open("seeyou.htm","","width=300,height=338")
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function loadpopup(){
if (get_cookie('popped')==''){
openpopup()
document.cookie="popped=yes"
}
}

</script>