Click to See Complete Forum and Search --> : Needed script for pop up window


guyver
01-02-2003, 01:31 PM
I need a script so when someone closes out of my site a pop up window will come up. I need it so they can fill in info. Can someone please help me with this. Thanks

pyro
01-02-2003, 01:50 PM
This should do it for you...

Put this is your head
function popup()
{

var url = "popup.htm";
var name = "popup";
var windowproperties = "width=550,height=300,location=yes,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,left=150,top= 150";

window.open(url, name, windowproperties);
}

NOTE: the window properties all must go on one line..A formating error by the forums.

This is your body tag.

What this will do is open a new page (popup.htm) when you close out of your page. Just make a page called popup.htm with you form on it.

<body onBlur="popup()">

guyver
01-02-2003, 02:04 PM
It didnt seem to work..heres the code I have

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body onBlur="popup()">
function popup()
{

var url = "popup.htm";
var name = "popup";
var windowproperties = " width=550,height=300,location=yes,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,left=150,top= 150";window.open(url, name, windowproperties);}
</body>

</html>

Heres what comes up..

function popup() { var url = "popup.htm"; var name = "popup"; var windowproperties = " width=550,height=300,location=yes,toolbar=yes,menu bar=yes,scrollbars=yes,resizable=yes,left=150,top= 150"; window.open(url, name, windowproperties); }

pyro
01-02-2003, 02:24 PM
Use this code instead. I noticed a bug in my last post...

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script type="text/javascript">
<!--Hide
function popup()
{
var url="popup.htm";
var name="popup";
var windowproperties="width=550,height=300,location=yes,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,left=150,top= 150";
window.open(url, name, windowproperties);
}
//End Hide-->
</script>
</head>
<body onUnload="popup()">
</body>
</html>

Once again, the code var windowproperties line must all be on one line. Here, I'll upload a .txt file you can download.

pyro
01-02-2003, 02:26 PM
Oh, by the way, the reason the your last one had all the stuff in the <body> was because the function needs to go in the <head>...Just thought I'd let you know.

guyver
01-02-2003, 02:36 PM
Thanks that seemed to work