Forum Moderators: open
Quick question for any Javascript experts, this code launches a pop on load. Can it be adapted so it pops on exit ( page closure ).
-------
<script language="javascript">
focusid=setTimeout("focus();window.showModelessDialog('http://www.webmasterworld.com/home.htm','','scroll:1;status:0;help:0;resizable:700;dialogWidth:985px;dialogHeight:700px')",0000)
</script>
-------
Thank you!
Put in Header:
<script src="cookiepop.js" language="JavaScript"></script>
Put in Body:
<body onunload="loadpopup()"
Make a cookie.js file with this:
function openpopup(){
window.open("http://www.yoursite.com/pop1.htm","Name of Pop","width=460,height=500")
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset!= -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
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"
}
}