JavaScript » Document » write

document.write("expression1", [expression2, [...]])

This method is used to write HTML expressions to the specified document.

This method is used to write HTML expressions and JavaScript code to the specified document in a current or new window.

Multiple arguments, ("expression1", [expression2, [...]]), can be listed and they will be appended to the document in order of occurrence. They can be of any type supported by JavaScript (string, numeric, logical), but all non-string expressions will be converted to a string before being appended.

In general, it is not necessary to open the document using the method, since the document.write method will automatically open the file and discard (erase) the contents. However, after the write is complete, you need to close the document by using the document.close method. In some browsers, the results of the write may not be completely displayed, due to buffering, until the close occurs.


newWindow ='', 'newWin')
var tagBoldOpen = "<b>"
var tagBoldClose = "</b>"
newWindow.document.write("This is some bold text.", tagBoldClose)