View Single Post
Old 04-13-2002, 03:40 AM  
ServerGenius
Confirmed User
 
Join Date: Feb 2002
Location: Amsterdam
Posts: 9,377
Hi there,

This sets a cookie so it will only pop-up once per session
it's loads the window on exit and is blurred.

PHP Code:

<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(999);
if(
pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((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=" ",height=" ",top=" mytop ",left=" myleft ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings);
win.blur();}

function 
getFuture(f){
var 
= 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 
0;
while (
clen) {
  var 
alen;
  if (
document.cookie.substring(ij) == arg)
  return 
getCookieVal (j);
  
document.cookie.indexOf(" "i) + 1;
  if (
== 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(offsetendstr));
}
// -->
< /script>


<
body onUnload="NewWindow('http://www.domain.com','byewindow','640','480','custom','back');"return false " onFocus= "this.blur();"> 
DynaMite
__________________
| http://www.sinnerscash.com/ | ICQ: 370820 | Skype: SinnersCash | AdultWhosWho |

Last edited by ServerGenius; 04-13-2002 at 03:41 AM..
ServerGenius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote