By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,735 Members | 1,264 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,735 IT Pros & Developers. It's quick & easy.

FAQ Topic - How do I communicate between frames in a web browser?

P: n/a
-----------------------------------------------------------------------
FAQ Topic - How do I communicate between frames in a web
browser?
-----------------------------------------------------------------------

To reference another frame, you simply need to step through the
frame hierarchy: parent is the page the frame is defined
in, parent.framename is another frame in the same frameset.
To access a variable called Moomin in a frame called Snork you
would use parent.Snork.Moomin . To call the function Snufkin
in that frame you would use parent.Snork.Snufkin() .
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.

Feb 14 '07 #1
Share this Question
Share on Google+
2 Replies

P: n/a
FAQ server wrote on 14 feb 2007 in comp.lang.javascript:
To reference another frame, you simply need to step through the
frame hierarchy: parent is the page the frame is defined
[..]

Shouldn't that be:

window.parent [just parent for short]

?

In general the FAQ should show complete references like:

document.location.href = '...'

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 14 '07 #2

P: n/a
VK
In general the FAQ should show complete references like:
document.location.href = '...'
window.location.href = "..."

document.location should not be used for assignment.
That is one of exceptions to simply memorize to speak the language
properly:

parent-parents but child - children (English language)

return false to prevent default action - but return true to prevent
default action for
1) onerror, 2) onmouseover (for status change), 3) omouseout (for
status change)

read property either from window.location or document.location - but
change property
only over window.location

As any historical exception each one has its own explanation which
modern speaker should not be bothered with. For the curious ones - and
skipping on English exceptions :-) -

onerror and status bar change are among the first handlers with pre-
historic event model in mind which is gone long ago except these. In
that model the logic was pretty much reversed against the current one.
Currently:
- Proceed with default action?
- No (false)

Pre-historic one:
- Prevent default action?
- Yes (true)

With location object historically (DOM 0) it was implemented for both
window and document objects but it was read/write for window and read-
only for document. The original intent of it is a bit obscure.
Possibly it reflects early ideas of how to implement multi-document
display - which is later went by other way to become frames. Unlike
handlers exception this one is almost gone out of use so on many
modern UAs document.location is write-allowed as well. Still there are
UAs following the old grammar, one of them is Safari.
This way a modern speaker should always use window.location form and
never document.location to be properly understood by everyone.

Feb 15 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.