473,549 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3386
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 WindowObjectRef erenceOfRequest edPopup ;

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

if(typeof window.screenX == "number" && typeof window.innerWid th ==
"number")
{
windowWidth = window.innerWid th * .68;
windowHeight = window.innerHei ght * .68;
windowLeft = window.screenX + window.innerWid th * .16;
windowTop = window.screenY + window.innerHei ght * .16;
}
else if(typeof window.screenTo p == "number" && typeof
document.docume ntElement.offse tHeight == "number")
{
windowWidth = document.docume ntElement.offse tWidth * .68;
windowHeight = document.docume ntElement.offse tHeight * .68;
windowLeft = window.screenLe ft + document.docume ntElement.offse tWidth *
..16;
windowTop = window.screenTo p - 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 (WindowObjectRe ferenceOfReques tedPopup == null ||
WindowObjectRef erenceOfRequest edPopup.closed)
{
WindowObjectRef erenceOfRequest edPopup = window.open(str Url, strTarget,
"top=" + windowTop + ",left=" + windowLeft + ",width=" + windowWidth +
",height=" + windowHeight + ",menubar,resiz able,scrollbars ,status");
}
else
{
WindowObjectRef erenceOfRequest edPopup.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:Advanc ed/Scripts & Plugins/Allow webpages
to:/Raise or lower windows
*/
}

function CloseRequestedP opup()
{
if(WindowObject ReferenceOfRequ estedPopup != null &&
!WindowObjectRe ferenceOfReques tedPopup.closed )
{
WindowObjectRef erenceOfRequest edPopup.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
10262
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 from clicking anything else on my page while the request is getting a new page. The popup window must lock the focus. I use frames i can not just...
2
8791
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: window.opener.top.location.top.close(); that doesn't work ...
1
4462
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
1765
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
2350
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! Martin
5
9583
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 opens and closes correctly but I need to find a way to cause the datagrid to refresh once the pop up closes. How can I force a postback once the...
1
1417
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
1957
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 other functions doesn't close the browser window. how can i do it? ***sorry, i'm find the way parent.window.close) close theme.
1
1843
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 to avoid that message . "window.opener = self" will not work as the window contains frame.
0
7461
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7971
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7491
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5101
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1068
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.