IFrames and mistery! Can someone explain?

T

Tom Szabo

I have been learning and practicing JS for a few weeks now. I have a good
understanding of most things and came up with a few complex modules.
Basically I am almost comlpleted my library code that is needed for some
development soon.

Unfortunately I am having a real confusion with IFrames. In order to achieve
some of my goals I have arrived to the conclusion that IFrames will suit the
best.

Well, in theory they would. In practice I have no idea...

.... why => window.parent.parent == window.parent ???

I have a page with a DIV and an IFRAME in it and I fill the DIV with a table
etc, and load the IFRAME with a URL. From the content of the DIV I use JS to
change the content of the IFRAME and I like to trigger from the content of
the IFrame a reload on the whole page. While trying to achieve the I had to
play around with reference to objects, and this is when I have found the
above ...

So "window.parent" actually the same as "window.parent.parent". I thought I
have to do more test, did not want to beleive it!

So I have created a variable in the main page ->

var oTask_DTV_Var = " Orig Value";

.....using from the page contained in the IFrame ...

window.alert(window.parent.oTask_DTV_Var) -> " Orig Value";

window.alert(window.parent.parent.oTask_DTV_Var) ; -> " Orig Value";

So both of the above expressions produce the same result.

??????? What am I missing????

TIA,

Tom
 
V

VK

??????? What am I missing????

That you cannot go beyond the Creation point :)
You cannot trace the human parentship deeper than Adam ;-), and you cannot
go further than the original parent window. After that 'parent' becomes a
self-reference ('self' property).
You may try though window.parent............parent.....parent and so on, to
see if the Lord pops up anywhere in the chain :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top