Document Write to other frame
I have sucessfully used document.write in a new window, but I now wish
to write to an already open & framed window. How do I do it. Please
show example, as I have trouble getting my head around JS.
Re: Document Write to other frame
You have to use the document object of the window into which you want
to write. So, assume you have two frames, frame_1 and frame_2 and
want to write from frame_1 to frame_1. You do as follows:
top['frame_1'].document.write("text to write").
top refers to the topmost or parent window, in which you have your
On 2 Jul 2004 22:06:45 -0700, firstname.lastname@example.org (Bruce)
>I have sucessfully used document.write in a new window, but I now wish
>to write to an already open & framed window. How do I do it. Please
>show example, as I have trouble getting my head around JS.
Re: Document Write to other frame
email@example.com (Myron Turner) wrote in message
> top['frame_1'].document.write("text to write").
Many thanks for your solution. It basically worked until I moved it
one more step into the eventual application. It is best to describe
everything using fruit/vegetables, so here goes ...
Apple spawns frames Banana & Cherry. Banana is an index, Cherry is
currently a simple list (it will eventually become an active clickable
list). When a user clicks on links in Banana, Banana creates Cherry by
means of "document.write"s. This is now working fine, thanks.
The "top['frame_1'].doc..." solution works when Apple is the
a time. When I moved Apple/Banana/Cherry into a current system, Date
(the fruit), I got an error. Date opens Apple as a new window. The
"top['frame_1'].doc..." hint I found now to cause an error, so I tried
"parent" in place of "top". If IE6 starts cold (ie after a reboot or
after being closed for a few minutes), I get the error "parent... is
not an object". The hierarchial & action structure is:
Banana >> Cherry
What do I need to do to avoid this error? This is the immediate
problem, but I also forsee a future problem ...
Eventually the system will comprise of the following:
Date (the fruit) is the main page. It can, as one of its clickable
links, open up, as a new window Apple, which spawns frames Banana
(index), Eggplant (a details page with nothing clickable), and Cherry
(a sub-index created by Banana). Eggplant already exists and is
working properly and is currently controlled by a framed page to be
merged with Banana. Cherry (the doc.write created document) will have
clickable links that will do the following:
1) Show details in Eggplant by means of html <a> (anchor) tags. No
2) Scroll the index Banana to show the clicked item at the top. Not
coded yet, but I expect no problems. I would probably use
"document.goto", but I have not tried that as yet. A reader may wish
to give an example of document.goto usage with another framed window.
3) This is the expected problem: Banana is then expected to recreate
Cherry, thus destroying the document that caused it to act. And how do
I call a function in another framed document?
The hierarchial & action structure will eventually be:
Eggplant & Banana >> Cherry (click)>> Eggplant & Banana >> Cherry.
Is this all possible, or have I become too attached to
fruit/vegetables and should stick to minerals?
In summary two problems:
P1: The error "parent... is not an object".
P2: Will there be an issue having a calling document being destroyed
before the call is returned. And how do I call a function in another
The problem does not seen to occur in XP/IE6, but in 98/IE6. I am
still trying to get the error under XP/IE6. The code has not been
|All times are GMT. The time now is 07:26 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.