A
Amir
What's the difference between the two ways of opening a new window and
writing to it?
Let's say I prepare a code that goes into a new window and save it in a
variable winHTML:
var winHTML = "<HTML><HEAD><TITLE>Any title</TITLE><BODY>Any
text</BODY></HEAD>";
Now, I have two ways to open a new window and write that code into the new
window:
One way is:
var newWin=window.open();
newWin.document.open();
newWin.document.write(winHTML);
newWin.document.close();
newWin.focus();
Other way is:
window.open("javascriptpener.winHTML");
Is there any reason why to prefer one over the other?
writing to it?
Let's say I prepare a code that goes into a new window and save it in a
variable winHTML:
var winHTML = "<HTML><HEAD><TITLE>Any title</TITLE><BODY>Any
text</BODY></HEAD>";
Now, I have two ways to open a new window and write that code into the new
window:
One way is:
var newWin=window.open();
newWin.document.open();
newWin.document.write(winHTML);
newWin.document.close();
newWin.focus();
Other way is:
window.open("javascriptpener.winHTML");
Is there any reason why to prefer one over the other?