Welcome to WebmasterWorld Guest from 18.206.48.142

Forum Moderators: open

Message Too Old, No Replies

Hi all, I`m new here - Javascript question

Pop-up / Exit question

     
11:44 pm on Dec 8, 2004 (gmt 0)

New User

10+ Year Member

joined:Dec 8, 2004
posts:8
votes: 0


Hi everbody, I`m new here and just wanted to say that this appears an excellent resource site.

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!

12:02 pm on Dec 14, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 27, 2001
posts:65
votes: 0


This is will pop on exit once per visit:

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"
}
}

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members