JavaScript - Displaying Document Properties

A004JS

The following includes several properties of the window.document. object.

These properties are referenced with the following code (using dot notation):

window.document.URL - This property gives the domain name and path on the server or computer
window.document.title - This property gives the title used on the Web page
window.document.lastModified - This property gives the date the Web page was last modified

Here are the window.document properties for this page:

An important side note: The + symbol is used to join text together (it is called concatination)

Here's an example of using + (concatination) to join "URL:" and window.document.URL

window.document.write("URL:" + window.document.URL);

Here's the code to dispplay the document properties:

        <script>
            // Use the method of the document to write properties
            window.codument.write("<p id='highlight'>");
        
            window.document.write("<strong>URL:</strong > " + window.document.URL);
        
            window.document.write("<br><strong>Title:</strong>" + window.document.title);
        
            window.document.write("<br ><strong>Last Modified:</strong >" + window.document.lastModified);
            
            window.document.write(" </p >");
        </script>