Hi
I am a new bie to Javascript programming. We have a scenario to launch a new browser window for a given HTML. I have the following approaches :
Approach 1:
my_window = window.open("", "report");
my_window.document.open();
my_window.document.write("<HTML> <BODY> HI </BODY></HTML>");
my_window.document.close();
Approach 2:
var newWindow = window.open("", "report");
newWindow.document.body.innerHTML = "<HTML> <BODY> HI </BODY></HTML>";
Could anyone sugges Which is the correct approach ? Our requirement is to have this code to work in any browser?
Thanks
I am a new bie to Javascript programming. We have a scenario to launch a new browser window for a given HTML. I have the following approaches :
Approach 1:
my_window = window.open("", "report");
my_window.document.open();
my_window.document.write("<HTML> <BODY> HI </BODY></HTML>");
my_window.document.close();
Approach 2:
var newWindow = window.open("", "report");
newWindow.document.body.innerHTML = "<HTML> <BODY> HI </BODY></HTML>";
Could anyone sugges Which is the correct approach ? Our requirement is to have this code to work in any browser?
Thanks
Comment