'
writeConsole('Hello from JavaScript!');
function writeConsole(content) {
top.consoleRef=window.open('','myconsole',
'width=350,height=250'
+',menubar=0'
+',toolbar=1'
+',status=0'
+',scrollbars=1'
+',resizable=1')
top.consoleRef.document.writeln(
'<html><head><title>Console</title></head>'
+'<body bgcolor=white onLoad="self.focus()">'
+content
+'</body></html>'
)
top.consoleRef.document.close()
}
In the above example, you might notice that
after you write something to the console several times,
the console window will allow you to navigate back and forth
in the output's history. This is not always a desired feature.
If you would like to output the new content without creating
a new history entry, add the following operator
after opening the window (and before the first write):
docRef = top.winRef.document.open("text/html","replace");
Here winRef is the window reference
returned by the window.open() method, and
docRef is a global variable in which the script stores
the reference to your new document.
JavaScripter.net.
Copyright
© 1999-2006, Alexei Kourbatov
| The JavaScript FAQ | ||
|---|---|---|
| Prev | Home | Next |
| Mirrored with kind permission of Alexei Kourbatov | Design by Interspire |