/    Sign up×
Community /Pin to ProfileBookmark

A Beginner to JavaScript

Hi guys, I am beginner to JavaScript. Plz help me understanding the below things.

1) what does this ‘top.opener’ and ‘opener.top’ mean ??

2) Whats the difference between ‘parent.document’ and ‘window’ ??

Could anyone explain on this with examples ???

It would be a great help for me.

Thanks, thanks, thanks … Many Thanks … in Advance.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@jsakalosJun 10.2007 — Hi guys, I am beginner to JavaScript. Plz help me understanding the below things.

1) what does this 'top.opener' and 'opener.top' mean ??

2) Whats the difference between 'parent.document' and 'window' ??

Could anyone explain on this with examples ???

It would be a great help for me.

Thanks, thanks, thanks ... Many Thanks ... in Advance.[/QUOTE]


When javascript runs in the browser there are always some objects available. First of them is [B]window[/B] object. If you use frames or iframes in your page these tags have their own window objects.

Let's say you have page with left and right frame. Page as a whole has one window object, left frame has another window object and right frame another one.

Now, left and right window objects have property [B]top[/B] which is main page's window object in fact. They have also [B]parent[/B] property that would hold also the main page window object in our example. If you have deeper nesting of frames/iframes then parent is one window up in hierarchy and top is always the main page window object.

opener property of the window (or parent or top) object is set only if you open a popup via javascript with method window.open(...)

I hope this helps.
×

Success!

Help @jacek spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.12,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...