FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Popup when leaving site

 


timerecords
Hello everybody,

I've got a website and there I want to put a popup on which will come when you leave the site

The codes aren't the problems but if I put them where they belong then they don't work.

Here are the codes and where you should put then:
Past this between your HEAD tags
Code:

<SCRIPT LANGUAGE='JAVASCRIPT' TYPE='TEXT/JAVASCRIPT'>
 <!--
var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus){
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=" + w + ",height=" + h + ",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.focus();}
// -->
</script>



Past this in your BODY tag
Code:

<BODY onUnload="NewWindow('http://home.deds.nl/~timerecords/MocroMusic/popup.html','popup','800','600','center','front');">


Now I've done that but as I said before it doesn't work. I think it's because I use frames.

This is my HTML code:

Index.html
Code:

<HTML LANG=EN>
<HEAD>
<TITLE>Welkom bij Mocro Music:: De site met muziek van Marokkaanse bodem !!</TITLE>
<META HTTP-EQUIV=Content-Type CONTENT=text/html;charset=ISO-8859-1>
<META NAME=AUTHOR CONTENT="Noureddine Design">
<META NAME=COPYRIGHT CONTENT="&copy; Copyright 2006, Noureddine Design">
<META NAME=KEYWORDS CONTENT="Jouw keywords gescheiden door een komma (tot 200 woorden is acceptabele voor de meeste zoekmachines)">
<META NAME=DESCRIPTION CONTENT="de beschrijving van je website, niet meer dan 255 karakters (letters en spaties)">
<META NAME=DATE CONTENT="Sat Aug 05 2006 22:59:11 GMT+0200">

<SCRIPT LANGUAGE='JAVASCRIPT' TYPE='TEXT/JAVASCRIPT'>
 <!--
var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus){
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=" + w + ",height=" + h + ",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.focus();}
// -->
</script>

<FRAMESET BORDER=0 FRAMEBORDER=0 BORDERCOLOR=WHITE FRAMESPACING=0 ROWS=120,*>
<FRAME SRC=Musicplayer.html NAME=upper SCROLLING=NO NORESIZE>
 <FRAME SRC=Home.html NAME=main SCROLLING=AUTO SCROLLING=AUTO>

<BODY onUnload="NewWindow('http://home.deds.nl/~timerecords/MocroMusic/popup.html','popup','800','600','center','front');"></BODY>
</FRAMESET><NOFRAMES>
</NOFRAMES>
</HTML>


I hope there is somebody who can/want help me.

Greetz,
Time Records
mariohs
I found a site that explains the onunload, onclose and onbeforeunload methods, unfortunately it's in portuguese... if you have difficulties understanding the source code (the code is simple), just let me know and I'll help you...
http://www.dei.isep.ipp.pt/~psousa/aulas/ADES/teste_eventos_6.htm
timerecords
Thx but I've already fixed it.
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.