473,320 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Close window with frames in it

Hi group,

Little question that bugs me ....

I have a page (window) with frames.
Topframe + MainFrame = page

I want to close the whole window, but don't know how

Can somebody help me with this one ?

Thx

Berre
Jul 20 '05 #1
1 3371
DU
SledgeHammer wrote:
Hi group,

Little question that bugs me ....

I have a page (window) with frames.
Topframe + MainFrame = page

I want to close the whole window, but don't know how

Can somebody help me with this one ?

Thx

Berre


Only a window opened via javascript can be closed with javascript.
Assuming this multi-frame page is a requested popup, then call the
close() method on the window object reference of that popup. E.g.:

<script type="text/javascript">
<!--
var WindowObjectReferenceOfRequestedPopup ;

function OpenRequestedPopup(strUrl, strTarget)
{
var windowWidth, windowHeight, windowLeft, windowTop;

if(typeof window.screenX == "number" && typeof window.innerWidth ==
"number")
{
windowWidth = window.innerWidth * .68;
windowHeight = window.innerHeight * .68;
windowLeft = window.screenX + window.innerWidth * .16;
windowTop = window.screenY + window.innerHeight * .16;
}
else if(typeof window.screenTop == "number" && typeof
document.documentElement.offsetHeight == "number")
{
windowWidth = document.documentElement.offsetWidth * .68;
windowHeight = document.documentElement.offsetHeight * .68;
windowLeft = window.screenLeft + document.documentElement.offsetWidth *
..16;
windowTop = window.screenTop - 50;
}
else
{
windowWidth = 500;
windowHeight = 250;
windowLeft = 60;
windowTop = 40;
};

/* The above code is just to define reasonable sizes and initial
positions to the popup to be. */

if (WindowObjectReferenceOfRequestedPopup == null ||
WindowObjectReferenceOfRequestedPopup.closed)
{
WindowObjectReferenceOfRequestedPopup = window.open(strUrl, strTarget,
"top=" + windowTop + ",left=" + windowLeft + ",width=" + windowWidth +
",height=" + windowHeight + ",menubar,resizable,scrollbars,status");
}
else
{
WindowObjectReferenceOfRequestedPopup.focus();
};

/*
The above 9 lines of code creates the popup; if the popup is already
opened, then it is only brought on top. This feature is possible only if
the user allows it in Mozilla-based browsers via the setting
Edit/Preferences.../category:Advanced/Scripts & Plugins/Allow webpages
to:/Raise or lower windows
*/
}

function CloseRequestedPopup()
{
if(WindowObjectReferenceOfRequestedPopup != null &&
!WindowObjectReferenceOfRequestedPopup.closed)
{
WindowObjectReferenceOfRequestedPopup.close();
};
}

-->
</script>

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: KS | last post by:
Is it possible to write a javascript that makes a popup window when someone click on buttons/href on my page and close itself when the new page is about to get loaded? I want to prevent the user...
2
by: find clausen | last post by:
I have opened this fullscreen (framed) window from a "top-page-setup-box" if (window.opener.top.location ....... How can I close it again from the same page, like: ...
1
by: Sandra Berland | last post by:
Hi, I would like to know if it exists a script to permit a button to close a pop up window with frames (the button is in one of this frame so) thanks
6
by: | last post by:
In IE, from the child window of a frameset i use the function top.window.close() And this works in IE, but not in nn4! How can i make this same effect in nn4? please help
3
by: Martin | last post by:
Hi, this is probably a very basic question but I'm not a javascript expert! Sure you get this asked often! Did some research but can't get it working. I'm thankful for any help! Thanks! ...
5
by: Mardy | last post by:
Hello I'm trying to use a pop-up to capture some information and then return the user to a datagrid containing the changes made in the pop-up. I have the database update working and the pop-up...
1
by: menmysql | last post by:
hi to all, my request is "can any one tell me how to close current window in frames" window.close() not working. urgent please regards
2
by: aqu | last post by:
Hi, my english is not good, so I'm sorring before) I have a problem. I have 3 frames on my page and fullscreen default mode. there is a "close" button in one of the frames. But window.close and...
1
by: CutCopyPaste | last post by:
I need to close a window after unsuccessfull password attempts, the problem is the window has frames and is not opened using javascript. When trying to close the window confirmation message, i want...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.