How do I write script-generated content to another window?
Submitted by: AdministratorYou can use the methods winRef.document.writeln() or winRef.document.write() to write the script-generated content to another window. winRef stands for windows reference, it is being returned by window.open() method. Use of winRef.document.close() can be used if you want your script's output to show up. Example code:
writeConsole('Hello world!');
function writeConsole(content) {
top.consoleRef=window.open('','myconsole', 'width=350,height=250'
+',menubar=0')
top.consoleRef.document.writeln( '<html><head><title>Console</title></head>' +' top.consoleRef.document.close() }
Submitted by:
writeConsole('Hello world!');
function writeConsole(content) {
top.consoleRef=window.open('','myconsole', 'width=350,height=250'
+',menubar=0')
top.consoleRef.document.writeln( '<html><head><title>Console</title></head>' +' top.consoleRef.document.close() }
Submitted by:
Read Online Expert Developer JavaScript Job Interview Questions And Answers
Top Expert Developer JavaScript Questions
☺ | Mention what is the disadvantage of using innerHTML in JavaScript? |
☺ | Which keyword is used to print the text in the screen? |
☺ | Why it is not advised to use innerHTML in JavaScript? |
☺ | Explain the concept of unobtrusive JavaScript? |
☺ | How are JavaScript and ECMA Script related? |
Top Scripting language Categories
☺ | AngularJS Interview Questions. |
☺ | Ext-JS Interview Questions. |
☺ | Dojo Interview Questions. |
☺ | Expert Developer JavaScript Interview Questions. |
☺ | jQuery Mobile Interview Questions. |