Home > Article > Web Front-end > JavaScript document.write() usage
document.write() Usage
In JavaScript, the document.write() function can write HTML expressions or JavaScript code to the document , usage "document.write(exp1,exp2,exp3,....)", this function can accept any multiple parameters and write them into the document.
Recommended video tutorial: "JavaScript"
document.write() Description
Although according to the DOM standard, this method only accepts a single string as parameter.
We usually use the write() method in two ways: one is to use this method to output HTML in the document, and the other is to generate it in a window or frame other than the window in which the method is called. New document. In the second case, be sure to use the close() method to close the document.
document.write() Example
<html> <body> <script type="text/javascript"> document.write("Hello World!"); </script> </body> </html>
Recommended tutorial: "JS Tutorial"
The above is the detailed content of JavaScript document.write() usage. For more information, please follow other related articles on the PHP Chinese website!