Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
JavaScript Popup Problem
Old 09-19-2003, 11:30 AM JavaScript Popup Problem
Junior Talker

Posts: 2
Trades: 0
Hi,

I have a popup on my website which appears every time someone leaves my homepage. Unfortunately,howver, it appears even if someone visits another page on my site. Please can someone tell me how to change this so that it only appears when people leave the site altogether?

My current code is below.

Thank you.
Joe Beaven




<SCRIPT LANGUAGE=\'JAVASCRIPT\' TYPE=\'TEXT/JAVASCRIPT\'>
<!--
var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus){
if(GetCookie(\"sid\") == \"999\"){return;}
document.cookie=\"sid=999; Path=/; Expires= \" + getFuture(1);
if(pos==\"random\"){myleft=(screen.width)?Math.flo or(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.rand om()*((screen.height-h)-75)):100;}
if(pos==\"center\"){myleft=(screen.width)?(screen. width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
else if((pos!=\'center\' && pos!=\"random\") || pos==null){myleft=0;mytop=20}
settings=\"width=\" + w + \",height=\" + h + \",top=\" + mytop + \",left=\" + myleft + \" ,scrollbars=yes,location=no,directories=no,status=
no,menubar=no,toolbar=no,resizable=no\";win=window .open(mypage,myname,settings);
win.focus();}

function getFuture(f){
var d = new Date();
d.setTime(d.getTime() + (86400000 * f));
return d;
}

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 getCookieVal (offset) {
var endstr = document.cookie.indexOf (\";\", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
// -->
</script>
successgold is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-19-2003, 01:04 PM
Omega's Avatar
Extreme Talker

Posts: 234
Location: Sharpsville, PA
Trades: 0
It's probably happening because they are essentually "leaving" that page, eventhough they stay on your site. You may want to consider using a header frame that contains the popup code, then when they leave the site, the frame will be closed and the popup will appear.
__________________
-----------------------------------------------
Current Projects:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
Omega is offline
Reply With Quote
View Public Profile Visit Omega's homepage!
 
Reply     « Reply to JavaScript Popup Problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11282 seconds with 12 queries