Name
write( ), writeln( ) — NN 2 IE 3 DOM n/a
Synopsis
write(”string“)
writeln(”string“)
When invoked as the page loads, these methods can dynamically add
content to the page. When invoked after the page has loaded, a single
method invocation clears the current document, opens a new output
stream, and writes the content to the window or frame. A
document.close( ) method is required afterward.
Because the first document.write( ) or
document.writeln( ) method destroys the current
document, do not use two or more writing statements to create a new
document. Instead load the content into one variable and pass that
variable as the parameter to a single document.write( ) or document.writeln( ) method.
The difference between the two methods is that
document.writeln( ) adds a carriage return to the
source code it writes to the document. This is not reflected in the
rendered content, but can make reading the dynamic source code easier
in browser versions that support dynamic content source viewing
(Navigator does so as a wysiwyg: URL in the source
view window).
Returned Value
None.
Parameters
-
string Any string value, including HTML tags. To write
<SCRIPT>tags, use entity characters for the brackets:<SCRIPT>.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access