PDA

View Full Version : close page on popup appearing


Dean
10-04-2002, 10:25 AM
hi there

I am trying to get a page to close the moment it has loaded a popup,

I have a bit of code that will close the window with no popup asking would i like to close the page. which is perect for the job but i can't seem to add it to the onload tag in the body tag and get it to work.

here is the code:

<html>
<head>
<title>Parent Window</title>
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onload="MM_openBrWindow('race.htm','race','width=400,height=380');window.Click();">
<object id=window type="application/x-oleobject"classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object><a href="#" onClick="window.Click();">Close Window</a>
</body>
</html>

If you look in the onlad tag i have put the window.Click(); bit of code from the lnk on the text that will close the page but it doesn't work.

Can anyone see where i am going wrong. I have had this working about a year ago but can't find where i did it or remeber how.confused:

Any suggestions welcome:

glenngv
10-04-2002, 10:37 AM
function openPopup(){
MM_openBrWindow('race.htm','race','width=400,height=380');
top.opener = window;
top.close();
}

<body bgcolor="#FFFFFF" text="#000000" onload="openPopup()">

be sure of its consequences. the users may be annoyed by it closing the parent window without alert.

Dean
10-04-2002, 10:51 AM
hi glenn

I tried the code you posted see below:

<html>
<head>
<title>2002 championship</title>
<script language="JavaScript">
function openPopup(){MM_openBrWindow('race.htm','race','width=400,height=380');top.opener = window; top.close();}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onload="openPopup()">
</body>
</html>

I get a page error that says line 5 charater 22 which is the MM_openbrowserwindow part.

Where have i gone wrong?:confused: :confused:

Maybe if i give your more info.
this page is a htm page that should pop a htm page with a .avi file in it then close.

I would of prefered the user not to see this page at all as i am using this page to show me the avi file as i can't get flash to import the file or the flash popup script to work as no matter how i try to configure it it won't work so i am cheating by having the flash do a geturl command then getting this page to do the pop up and dissapear.

glenngv
10-04-2002, 10:57 AM
you are calling the function MM_openBrWindow() but you did not include it in your page.

anyway you can just do it like this:

<script language="JavaScript">
function openPopup(){
window.open('race.htm','race','width=400,height=380');
top.opener = window;
top.close();
}
</script>