NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page JavaScript Popup Problem

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 09-19-2003, 08:01 AM THREAD STARTER               #1 (permalink)
New Member
Join Date: Sep 2003
Posts: 2
successgold is an unknown quantity at this point
 



JavaScript Popup Problem


Hi,
????: NamePros.com http://www.namepros.com/programming/15277-javascript-popup-problem.html

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.floor (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.wi dth-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  
Old 09-20-2003, 04:01 PM   #2 (permalink)
Senior Member
Join Date: Aug 2002
Posts: 1,255
deadserious has a spectacular aura aboutdeadserious has a spectacular aura about
 



This script may work for what you're wanting to do http://javascriptkit.com/script/script2/popunder.shtml
deadserious is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 12:50 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger