Help trying to close popup window

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
lloydie-t
Forum Commoner
Posts: 88
Joined: Thu Jun 27, 2002 3:41 am
Location: UK

Help trying to close popup window

Post by lloydie-t »

I have some php code which generates a popup window while it process data. The problem I am having is trying to close the window automatically when the main page loads. The opening page is in a frame.
The sequence should work like this:

first page opens popup window -> first window loads new page -> new page closes popup window onload

but it does'nt.

this is the code I have being trying.

Code: Select all

// first page
<SCRIPT LANGUAGE="JavaScript"> 
window.open("process_data.html", 'newWin', 
'width= 200px, height=100px, toolbar = no, status = no,
scrollbars = yes, resizable = yes');
window.close();
</SCRIPT></p>

//secondpage
<head>
<script>
function closeWin(newWin) &#123;
newWin.close();
&#125;
</script>
</head>

<body bgcolor="#dddddd" leftmargin="0" marginheight="0"
marginwidth="0" topmargin="0" onLoad="closeWin();">

Any Ideas?

I am rubbish with JS, so any help is appreciated.
Skyzyx
Forum Commoner
Posts: 42
Joined: Fri Feb 14, 2003 1:53 am
Location: San Jose, CA

Post by Skyzyx »

I'd try this:

First page:

Code: Select all

<script type="text/javascript">
//<!&#1111;CDATA&#1111;

window.open("process_data.html", 'newWin', 'width= 200px, height=100px, toolbar = no, status = no, scrollbars = yes, resizable = yes');

//]]>
</script>
Second page:

Code: Select all

<head>
<style type="text/css">
body &#123;
	background-color:#ddd;
	margin:0;
	padding:0;
&#125;
</style>
</head>

<body onload="setTimeout('window.close();', 1000)">
Hope this helps!
Post Reply