[thelist] js window problem

Cake cake at brothercake.com
Wed Feb 26 17:47:00 CST 2003

I've had something similair before, in some mozilla builds .. Er ..
Sometimes.  Sorry that's not so specific, but I never did lock it down
for sure. I eventually adopted a maxim: "children of the body do not
exist until *after* the entire document has rendered"; I don't think
this is really true in a procedural sense, but the method it implies -
don't try and read from or write to the body before window.onload has
happened - made the problem go away.

So now I always work from that assumption, and I've never had that kind
of problem since.


-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org] On Behalf Of Hans Fraser
Sent: 26 February 2003 23:10
To: evolt List
Subject: [thelist] js window problem

ok here it goes,

this is the script i have (well ... a simplified version of the script):

		// i create a new window
		var newwindow=window.open("","favWin","titlebar=no,

		// write in the window
		// close the window document !

		// pull the html from the apropriate layer and feed it
to the page!
		newwindow.document.body.innerHTML = "some html";

it has no problem with ie mac or pc, safari but with mozilla it creates
the window all right but i get this error:

newwindow.document.body has no properties

it seems that the script does not recognize the document object  or more
like the window opens so and writes in it so fast that it does not have
time to process what has actually appened ... it opens the window
without a problem and writes in it all right but ... still i get
"newwindow.document.body has no properties".

if i put an alert right after the document.close() it seems to give off
time for the window to be properly opened and registered and executes
the rest of the script after the alert perfectly.

any body gat an idea on how to get rid of this problem ... i am stumped!


* * Please support the community that supports you.  * *

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !

More information about the thelist mailing list