...

View Full Version : Reading from child frame/window



atainc
07-07-2003, 01:46 AM
Here's the scoop...

I have a index.html ("parent") page that calls 2 iframes like this:

<iframe name="textFrame" id="textFrame" src="blank.html" frameborder="0" border="0" width="350" height="220"></iframe>
<iframe name="queue" id="queue" src="queue.html" frameborder="0" border="0" width="350" height="220"></iframe>

I am trying to read the content of queue.html (queue) from my index.html page and write it to blank.html (textFrame) like this:

var qFrame = document.queue;
var qmess = qFrame.document.rec_mes;
textFrame.document.write(qmess);

The content of queue.html is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><title>MessQueue</title>
</HEAD>

<BODY>
<div id="rec_mes" name="rec_mes">text goes here</div>
</BODY>
</HTML>


Now... the problem is, instead of it returning "text goes here" it returns "undefined". What am I doing wrong preventing it from pulling the value in the "queue" page. PS- Both of these pages are on the same site (well I'm running them locally with IE as I test) and opened from index.html. I have no problem writing, just the reading of the "queue" page. I have a feeling my DOM or queue page may be incorrect?

Any help would be appreciated...!!!

Thanks!

Kor
07-07-2003, 09:00 AM
hm... do you mean you wanna read smth from a page opened into an iframe to another page opened from the same iframe?... I don't know if it is possible using client-side application... as long as you have not a sort of "anchor"...

If this is your problem, my ideea is to write whichever on the queue.html using a script written on the parent frame(index), than call that script from the index into blank.html using something like parent.the_function_name()

The ideea is that when calling a fuction written on parent, you have to specify that...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum