write to a different frame

R

Ray Schaeffer

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
 
L

Lasse Reichstein Nielsen

Ray Schaeffer said:
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
 
R

Ray Schaeffer

Thanks for the reply
The code is below and comments interspersed.
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.
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..."
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>
 
R

Ray Schaeffer

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
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
 
L

Lasse Reichstein Nielsen

Ray Schaeffer said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top