[thelist] js window problem

Hans Fraser hfraser at videotron.ca
Wed Feb 26 17:09:01 CST 2003


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,
toolbar=no,location=no,directories=no,status=no,
menubar=no,scrollbars=yes,resizable=yes,width=332,height=225");

		// write in the window
		newwindow.document.open();
		newwindow.document.write('<html>\n');
		newwindow.document.write('<head>\n');
		newwindow.document.write('<title>-</title>\n');
		newwindow.document.write('<body>\n');
		newwindow.document.write('</body>\n');
		newwindow.document.write('</html>\n');
		// close the window document !
		newwindow.document.close();


		// 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!

hans!




More information about the thelist mailing list