When are you getting that error? Is the new window opening at all? (i’d think the syntax of “Window.open” would be “window.open”…?)
When are you calling function2?
Try this syntax:
PrintFormWindow.document.writeln(‘test’);
Also if you’re not doing so already, test your page in Mozilla Firefox. It’s got a great Javascript console that actually gives you clues to what the problem is and where the offending line is located unlike IE which likes to be vague.
Mozila doesn’t even allow me to spawn the first window. Popup blocker.
IE lets me spawn it even with Popup blocker on. IE will not let me spawn a second window from the first. It gets blocked. My solution was to write the info I need to the first window spawned with writeln.
declare var child in your main document javascript code, outside of any functions. (Probably not necessary, but always good to declare your variables. )
add
child = Win1
to function 1. (You don’t need to reference opener unless you have javascript running inside the PrintFormWindow)
then have function2 refer to child.document instead of windowwhatever.document
By the way, you do realize that once the document in printFormWindow has finished loading, any attempt to write to it again will overwrite what you already have?? (IIRC) To keep whatever is there and add extra text to that window, you’ll need to used DHTML or some other fancy tricks.