473,480 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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.

TIA

Bruce
Jul 23 '05 #1
2 2167
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
frameset tags.

Myron Turner
On 2 Jul 2004 22:06:45 -0700, ap***************@yahoo.com.au (Bruce)
wrote:
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.

TIA

Bruce


Myron Turner
www.room535.org
Jul 23 '05 #2
tu******@shaw.ca (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
controlling page, however Javascript is like a minefield - one step at
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:
Date
Apple
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
problems expected.
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:
Date
Apple
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
framed document?

TIA

Bruce
(Fruit/Vege Fanatic)

Footnote:
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
changed.
Jul 23 '05 #3

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

Similar topics

1
1922
by: David Logan | last post by:
Hello, I am trying to write a page that displays a PDF document in right site of the page and a navigation bar on the left side. The only way I know to do this is using frames or iFrames and I...
4
5997
by: Bernard | last post by:
Hi, I am suddenly getting Safari script errors with the following user agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8 In a...
5
1842
by: imaband | last post by:
Hi, I've got a little Quizzer program that asks a question in the upper frame of a frameset and then lists the answer in the lower frame. Answers can be plain text, straight html, a sound, or a...
6
3672
by: skubik | last post by:
Hi everyone. I'm attempting to write a Javascript that will create a form within a brand-new document in a specific frame of a frameset. The problem is that I can create the form and input...
7
2287
by: David Hayes | last post by:
I tried finding an answer on http://www.quirksmode.org/ without success. I am attempting a complicated Frames structure. I have made it work in IE, but not Netscape. I begin with three...
26
45462
by: Dave Hammond | last post by:
In document "A.html" I have defined a function and within the document body have included an IFRAME element who's source is document "B.html". In document "B.html" I am trying to call the function...
8
3719
by: johnsonlau | last post by:
When I use document.write to replace the comment of a frame, I found that the page was always showing as loading in Firefox (2.0.0.2). But it seems that it is OK in IE6. Could someone help me...
0
7054
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,...
0
6918
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...
0
7057
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,...
0
7102
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...
0
5357
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,...
1
4798
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4495
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...
0
3008
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3000
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.