Each of these script execute fine on their own. But once I combine them as shown, only the first script will execute.
My goal is to have a "popup immediately" on a page close and then a "delayed popup" when the same page closes.
#1)
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var exit=true;
function leave() {
if (exit)
window.open('http://www.anypage.htm','','toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,height=460,width= 700');
}
// End -->
</SCRIPT>
</head>
<body bgcolor="#FFFFFF" onUnload="leave()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
#)2
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
closetime = 0;
// Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds
function Start(URL, WIDTH, HEIGHT)
{windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);}
function doPopup() {url = "http://any page.html";width = 267;
// width of window in pixels
height = 103;
// height of window in pixels
delay = 20;
// time in seconds before popup opens
timer = setTimeout("Start(url, width, height)", delay*1000);}
// End
-->
</script>
<body OnLoad="doPopup();">
Combining the script to execute on page unload only.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var exit=true;
function leave() {
if (exit)
window.open('http://www.anypage.htm','','toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,height=460,width= 700');
}
// End -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
closetime = 0; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds
function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;
preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);
}
function doPopup() {
url = "http://www.anypage.html";
width = 267; // width of window in pixels
height = 103; // height of window in pixels
delay = 2; // time in seconds before popup opens
timer = setTimeout("Start(url, width, height)", delay*1000);
}
// End -->
</script>
</head>
<body bgcolor="#FFFFFF" onUnload="leave();doPopup();" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
have also tried this line in the combination script to no avail.
timer = setTimeout("Start(" + url + ", " + width + ", " + height + ")", delay*1000);
My goal is to have a "popup immediately" on a page close and then a "delayed popup" when the same page closes.
#1)
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var exit=true;
function leave() {
if (exit)
window.open('http://www.anypage.htm','','toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,height=460,width= 700');
}
// End -->
</SCRIPT>
</head>
<body bgcolor="#FFFFFF" onUnload="leave()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
#)2
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
closetime = 0;
// Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds
function Start(URL, WIDTH, HEIGHT)
{windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);}
function doPopup() {url = "http://any page.html";width = 267;
// width of window in pixels
height = 103;
// height of window in pixels
delay = 20;
// time in seconds before popup opens
timer = setTimeout("Start(url, width, height)", delay*1000);}
// End
-->
</script>
<body OnLoad="doPopup();">
Combining the script to execute on page unload only.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var exit=true;
function leave() {
if (exit)
window.open('http://www.anypage.htm','','toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,height=460,width= 700');
}
// End -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
closetime = 0; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds
function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;
preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);
}
function doPopup() {
url = "http://www.anypage.html";
width = 267; // width of window in pixels
height = 103; // height of window in pixels
delay = 2; // time in seconds before popup opens
timer = setTimeout("Start(url, width, height)", delay*1000);
}
// End -->
</script>
</head>
<body bgcolor="#FFFFFF" onUnload="leave();doPopup();" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
have also tried this line in the combination script to no avail.
timer = setTimeout("Start(" + url + ", " + width + ", " + height + ")", delay*1000);