473,396 Members | 2,033 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,396 software developers and data experts.

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 3657
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*****@hotmail.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*****@hotmail.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


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, appropriateWindow.functionName)

Csaba

"Andrew Poulos" <ap*****@hotmail.com> wrote in message news:42*********************@per-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
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...
6
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...
3
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...
3
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...
2
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...
1
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"...
8
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...
0
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...
0
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...

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.