473,791 Members | 3,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why doesn't frameset onload event get called when each of the frames has an onload?

Hi,

I'm having a hard time figuring out why the onload event is not being
called for the frameset window in the following simple example. It is
being called for each of the component frames.

Here's the code:

mainpage.html:

<html>
<head><title>Ma in page</title></head>
<frameset rows="200,*,*">
<frame src="f1.html">
<frame src="f2.html">
<frame src="f3.html">
</frameset>
</html>
<script src = "common.js" ></script>
------------
f1.html:

<html>
<head><title>Fr ame 1</title></head>
<body bgcolor="#ffcc0 0">
<center>THIS IS FRAME 1</center>
</body></html>
<script src = "common.js" ></script>
------------
f2.html:

<html>
<head><title>Fr ame 2</title></head>
<body bgcolor="#6666f f">
<h2>This is Frame 2</h2>
</body></html>
<script src = "common.js" ></script>
------------
f3.html:

<html>
<head><title>Fr ame 3</title></head>
<body bgcolor="#00ff6 6">
<center>....... ...frame 3</center>
</body></html>
<script src = "common.js" ></script>
------------
common.js:

window.onload = on_load;
function on_load()
{
alert("in on load for " + self.document.l ocation);
}

Thanks and appreciate any help,

-Adnan.

Jul 23 '05 #1
5 8639
I think I figured out the problem. On a frameset page, you can't have
any other content, like the javascript src tag, and so the onload
method is not associated with the onload event for the frameset page.

Jul 23 '05 #2
In article <11************ **********@z14g 2000cwz.googleg roups.com>, adnanx82
@gmail.com enlightened us with...
I think I figured out the problem. On a frameset page, you can't have
any other content,


Sure you can.
I do.

Your problem is your script, not the frameset. The script is being called
after the page has loaded already, rendering it useless. Put the script
before the body/frameset tag (inside head), not after the end html tag.

--
--
~kaeli~
Murphy's Law #3020: Quality assurance doesn't.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #3
Thanks for your reply. Do you know why it works for the frame pages
though? It seems like the onload event is being registered and called
for the frame pages even though the script is at the end, but not for
the frameset page.

Thanks,

-Adnan.

Jul 23 '05 #4
In article <11************ *********@z14g2 000cwz.googlegr oups.com>, adnanx82
@gmail.com enlightened us with...
Thanks for your reply. Do you know why it works for the frame pages
though? It seems like the onload event is being registered and called
for the frame pages even though the script is at the end, but not for
the frameset page.


No, I don't, but I do know putting it in the head of the frameset solved the
problem.
I just tested it.

And you're right: it works fine for the other pages. I have no idea why.

--
--
~kaeli~
He's your God, they're your rules - you burn in Hell.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #5
ad******@gmail. com wrote:
Thanks for your reply. Do you know why it works for the frame pages
though?
Though? Read again: It works for the frameset window as well but you
have positioned it wrong within the source code of its document.
It seems like the onload event is being registered and called
for the frame pages even though the script is at the end, but
not for the frameset page.


Every frame is a implemented as a separate Window object.
PointedEars
Jul 23 '05 #6

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

Similar topics

1
3939
by: ck388 | last post by:
I am trying to open a frameset in a new window......where the frame called "main" shows the file called customerGeneral.aspx. I can't get it to work though...i always get something like frames.main.location is null....seems like the frameset is not loaded before wnd.frames.location.replace(URL) is called. If i add an alert("TEST") between the window open and the frame replacement....then it works. The alert("TEST") seems to ensure that...
13
2723
by: Kai Grossjohann | last post by:
I have a web app which comprises different frames: a menu bar frame, a search form frame, a result list frame. Depending on the state, only a subset of these frames is available. (Eg, after login, only the menu bar frame exists to allow the user to select a search form. After this, only the menu bar and the search form are visible.) Now the users are to be able to resize the frames. WIBNI the webapp could remember the frame sizes...
4
9515
by: Iver Erling Årva | last post by:
I have an application that uses a window.open() to open it's own main window where all my programs takes place. I use a timeout so if nothing goes on for 15 minutes the document below is called. To log in again all the users have to do is to click the link in the lower part of the window. This causes the login window to show up again. The problem arise if the window that opened this window has been closed in the meantime. To deal with this...
3
3682
by: Andrew Poulos | last post by:
In a frameset I have this: window.onload = function() { frames.onunload = function() { alert('I'm going now'); } } when frames unloads I'm expecting the alert to be called but it never does. If, instead, I put this into frames it does call the alert:
14
6539
by: Alex Molochnikov | last post by:
Is there any way to embed the HTML code inside FRAMESET? Something like this: <frameset cols="50%,*"> <frame src=" ... HTML code for the frame ... "> <frame src="Frame2.html" name="main"> </frameset><noframes></noframes> I tried using a Javascript function that returns the HTML text, as in the following code:
0
1986
by: Eyal | last post by:
hi to all, i have the following: frames.html: <html> <head> </head> <frameset cols="*,*"> <frame src="a.html" name="a" /> <frame src="http://google.com" name="b" />
0
9669
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
9515
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
10427
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
10207
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
10155
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
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
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
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.