JavaScript Methods - document.write()

A003JS

As you write your JavaScript code, please remember that JavaScript is not as forgiving as HTML. If you code something wrong, your Web page generates an error. Be patient and keep these things in mind when coding JavaScript:

For example, your browser window is an object. We can refer to this object via JavaScript by using "window."

The browser window contains other objects, such as the document object. You can refer to the document object by using "window.object."

The following is a method (action) of the document object. This method is called by using the following code:

window.document.write();

<script>

                
                    // Use JavaScript to write to this document
                    //Use the write method of the document
                
            

window.document.write("<p id= "highlight"> I am using JavaScript to write the opening to this page. This text has been created by using window.document.write </p> ");

</script>