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

write to a different frame

P: n/a

Hi,

I've written a very simple test HTML/JS program where
the JS code in one frame writes to a different frame with
"parent.frame1.document.write(...".
This seems to work ok with IE-6, but with NS-7, after the
first write, the "loading" seems to loop forever and if you
click on "stop", the write will not work anymore. Also in
NS, if you push reload, the write will not work anymore.
Both NS and IE seem to perform the write slowly, and in
multiple writes in rapid succession, some will be dropped.

Can someone help ?

Thanks
Ray

Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Ray Schaeffer <re******@cox.net> writes:
I've written a very simple test HTML/JS program where
the JS code in one frame writes to a different frame with
"parent.frame1.document.write(...".
This seems to work ok with IE-6, but with NS-7, after the
first write, the "loading" seems to loop forever
The "loading" state stays until you close the document again
(i.e., "parent.frames['frame1'].document.close()").
and if you click on "stop", the write will not work anymore.
Also in NS, if you push reload, the write will not work anymore.
How "not work". What does the javascript console say?
Both NS and IE seem to perform the write slowly, and in multiple
writes in rapid succession, some will be dropped.


Weird, but that's all I can say without seeing the code.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

P: n/a

Thanks for the reply
The code is below and comments interspersed.

Lasse Reichstein Nielsen wrote:
Ray Schaeffer <re******@cox.net> writes:

I've written a very simple test HTML/JS program where
the JS code in one frame writes to a different frame with
"parent.frame1.document.write(...".
This seems to work ok with IE-6, but with NS-7, after the
first write, the "loading" seems to loop forever

The "loading" state stays until you close the document again
(i.e., "parent.frames['frame1'].document.close()").


If you close, to stop the loading, it appears that you cannot
write to it again.

and if you click on "stop", the write will not work anymore.
Also in NS, if you push reload, the write will not work anymore.

How "not work". What does the javascript console say?


a. "not work" = nothing written
b. I have gotten the JS console to give errors, but not can not make
it repeatable. The error is somthing like: "...undocumented error..."

Both NS and IE seem to perform the write slowly, and in multiple
writes in rapid succession, some will be dropped.

Weird, but that's all I can say without seeing the code.

/L


==== Parent ================================================== =====
<HTML>
<HEAD><TITLE>Frames Example</TITLE></HEAD>
<!-- divide into columns -->
<!-- 1st = 50 % -->
<!-- 2nd = whatever is left over -->
<FRAMESET COLS="50%,*">
<FRAME SRC="frame1.html" NAME="frame1">
<FRAME SRC="frame2.html">
</FRAMESET>
<BODY>
</BODY>
</HTML>
==== frame1.html ==================================================
<HTML>
<HEAD><TITLE>Frames Example</TITLE></HEAD>
<BODY>
</BODY>
</HTML>
==== frame2.html ==================================================
<HTML>
<HEAD><TITLE>Frames Example</TITLE></HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide from old browsers
//
function doit()
{
//parent.frame1.document.open();
parent.frame1.document.write("Hello<br>");
//parent.frame1.document.close();
//alert("done");
}
//
// end script hiding -->
</SCRIPT>
Frame 2 text<BR>
Hello<BR>

<table border=1 cellpadding=3 bgcolor="#5cacee">
<!-- Buttons -->
<tr bgcolor="#5cacee">
<form NAME="roundit">
<td> <font face=arial size=-1> <b> <p align="center">Rounding</p> </b>
</font>
</td>
<td>
<p align="center"><input TYPE="text" NAME="roundval" SIZE=1> </p>
</td>
<td>
<p align="center"><input TYPE="button" VALUE=" Set "
Onclick="doit()"></p>
</td>
</form>
</tr>
</table>
</BODY>
</HTML>

Jul 20 '05 #3

P: n/a

Here is the error
=================
Error: uncaught exception: [Exception... "Component returned failure code:
0x80004001 (NS_ERROR_NOT_IMPLEMENTED)
[nsIEditorShell.GetSelectedOrParentTableElement]" nsresult: "0x80004001
(NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame ::
chrome://editor/content/editor.js :: goUpdateTableMenuItems :: line 2463" data: no]
================

Thanks

Lasse Reichstein Nielsen wrote:
Ray Schaeffer <re******@cox.net> writes:

I've written a very simple test HTML/JS program where
the JS code in one frame writes to a different frame with
"parent.frame1.document.write(...".
This seems to work ok with IE-6, but with NS-7, after the
first write, the "loading" seems to loop forever

The "loading" state stays until you close the document again
(i.e., "parent.frames['frame1'].document.close()").

and if you click on "stop", the write will not work anymore.
Also in NS, if you push reload, the write will not work anymore.

How "not work". What does the javascript console say?

Both NS and IE seem to perform the write slowly, and in multiple
writes in rapid succession, some will be dropped.

Weird, but that's all I can say without seeing the code.

/L


Jul 20 '05 #4

P: n/a
Ray Schaeffer <re******@cox.net> writes:
If you close, to stop the loading, it appears that you cannot
write to it again.
You can, but when you do, you open the document again, which
clears it. So the old line is erased, and a new, identical, line
is written.

Document.write is only meant for using while a document is being
loaded. That is why an opend document triggers the "loading" icon
stat in Mozilla/Netscape. There is no way to avoid this if you use
document.write to write the data to the new page.

Alternatives are using .innerHTML or DOM (where I prefer DOM):

var otherDoc = parent.frames['frame1'].document;
otherDoc.body.appendChild(otherDoc.createTextNode( "Hello"));
a. "not work" = nothing written
I can see the problem in Mozilla.
b. I have gotten the JS console to give errors, but not can not make
it repeatable. The error is somthing like: "...undocumented error..."


I can't reproduce that, though. I am using Mozilla 1.5a (or usually
Mozilla Firebird 0.6). I don't get lost lines, slow writing or funny
error messages, so I can't help you with that.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.