473,890 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling onunload in frameset

In a frameset I have this:

window.onload = function() {
frames[1].onunload = function() {
alert('I'm going now');
}
}

when frames[1] unloads I'm expecting the alert to be called but it never
does. If, instead, I put this into frames[1] it does call the alert:

window.onunload = function() {
alert('I'm also going now');
}

How can I get it to work from the frameset?

Andrew Poulos
Jul 23 '05 #1
3 3684
As I understand your question, your example code is saying, put an onload
handler on my frame as I'm [= the frameset] unloading myself. But by then
I'd expect my frame to already be gone. To double check this, also put
an alert before the frames[1].onunload = function() ... statement.

Csaba Gabor from Vienna

"Andrew Poulos" <ap*****@hotmai l.com> wrote in message news:42******** *************** @per-qv1-newsreader-01.iinet.net.au ...
In a frameset I have this:

window.onload = function() {
frames[1].onunload = function() {
alert('I'm going now');
}
}

when frames[1] unloads I'm expecting the alert to be called but it never
does. If, instead, I put this into frames[1] it does call the alert:

window.onunload = function() {
alert('I'm also going now');
}

How can I get it to work from the frameset?

Andrew Poulos

Jul 23 '05 #2
Csaba2000 wrote:
As I understand your question, your example code is saying, put an onload
handler on my frame as I'm [= the frameset] unloading myself. But by then
I'd expect my frame to already be gone. To double check this, also put
an alert before the frames[1].onunload = function() ... statement.

Csaba Gabor from Vienna

"Andrew Poulos" <ap*****@hotmai l.com> wrote in message news:42******** *************** @per-qv1-newsreader-01.iinet.net.au ...
In a frameset I have this:

window.onlo ad = function() {
frames[1].onunload = function() {
alert('I'm going now');
}
}

when frames[1] unloads I'm expecting the alert to be called but it never
does. If, instead, I put this into frames[1] it does call the alert:

window.onunlo ad = function() {
alert('I'm also going now');
}

How can I get it to work from the frameset?

Andrew Poulos


I think I didn't state my problem unambiguously. Let me try again:

Without putting any script into each frame how can a frameset detect
events, such as onload and onunload, from each frame (as opposed to the
entire frameset)?

Andrew Poulos

Jul 23 '05 #3
I would try (not that I have, mind you):
Put into the <head> section of the frameset page:
<script type='text/javascript'>
function myFunc() { alert("Here I am"); }
top.onload = top.setTimeout( function() {
top.frames[1].onunload = top.myFunc; }, 100)
</script>

the setTimeout business is because it may be that the frameset's onload
fires when the page is read in and not after all the frames have loaded.
If you determine which it is, it would be good if you would let the group
know - and perhaps you can relax part of the above code (if it works
at all, that is).

Also, when you are doing anything with functions across frames it is a
good idea to fully qualify them (ie, appropriateWind ow.functionName )

Csaba

"Andrew Poulos" <ap*****@hotmai l.com> wrote in message news:42******** *************@p er-qv1-newsreader-01.iinet.net.au ...
I think I didn't state my problem unambiguously. Let me try again:

Without putting any script into each frame how can a frameset detect
events, such as onload and onunload, from each frame (as opposed to the
entire frameset)?

Andrew Poulos

Jul 23 '05 #4

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

Similar topics

2
5660
by: Simon Wigzell | last post by:
I'm using OnUnLoad in my body statement to redirect to a function to clean things up if someone exits a form by closing it from outside the webpage code - e.g. by not using the cancel or save and exit buttons I have supplied but by clicking on the browser window top right X or closing it by clicking with the right mouse button on the tray icon for the window. Unfortunately it is also triggered by a refresh, which my web page does as part of...
6
15915
by: kaeli | last post by:
Hey guys, This error occurs ONLY in Netscape 7.0. Not in 7.1. So, I think it's a bug. Buuuut... Has anyone had this problem or know of a fix? When attempting to have an onunload function set with "window.onload=", the error comes up "permission denied to set property window.onunload"
3
6978
by: Laurent | last post by:
I am trying to use the onunload event to know when the user closes a popup by receiving a request on the web server. I have a main page from where the user opens a popup. What I want is when the user closes the popup, it sends a request to my web server (GoAhead) using the onunload event, then closes the popup. For the moment, this what i have: when the user closes the popup, I use the onunload event to open a different popup (by this...
3
3553
by: John Bokma | last post by:
I have two windows in a frame. I want to be able that each can open a pop up window and that the handle to that window can be stored somewhere, so that each can talk to the pop up. is it possible that window 1 in a frameset calls a function in window 2, ie. something like: window 1: ....
2
5766
by: M B HONG 20 | last post by:
Hi all - I am developing an ASP.NET (C#) application and need some help. I wish to call a server-side function (in the code-behind "file.aspx.cs") upon a user clicking on the "X" to close the browser window. Is there a way to postback and call a server-side function when this happens? I am aware of the browser's native "onunload" event, but am not certain that what I'm looking for is actually possible. Any help would be greatly...
1
1535
by: Tim Arview | last post by:
Hi, I'm trying to create an exit popup that doesn't require anything added to the body tag. In other words, I don't want to say <body onunload="foo">. I just want to have window.onunload="foo" in the <scripttag. However, when I do that, it launches foo as soon as the page loads and does NOT launch when the page is unloaded.
8
4120
banning
by: banning | last post by:
<!-- Google maps has a tendency to wreck things. Load it LAST! It can interfere with other stuff loading --> <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAArSHIvK5GjeMNDX4RccZ9MhQrmFaz44GnQXOo27J3f2GHeKYI9xTi9qFD_LdIDqtpRDvM4YWE8kto-A" type="text/javascript"></script> <script type='text/javascript'> function setImage() { document.getElementById('eventLogoDiv').innerHTML='<a...
0
9978
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9822
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10819
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10923
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7169
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5851
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4676
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
3
3277
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.