Assignment 007

JavaScript Properties I

JavaScript is a scripting language that uses objects. For example, your browser window is an object, which contains the document object. We can refer to these objects via JavaScript by using "window.document."

The following includes several properties of the window.document object. These properties are referenced with the following code:

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:

URL: http://www.chswebdesign.com/mrchagoyan/assignment007/assignment007.htm
Title: JavaScript Properties-Assignment007
Last Modified:09/19/2008 08:13:28

An important side note:

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 display the document properties:

<script language="javascript" type="text/javascript">
//This is a JavaScript comment
window.document.write("<p><strong>URL:</strong> " + window.document.URL +"<br><strong> Title:</strong> " +window.document.title + "<br><strong>Last Modified:</strong>" +window.document.lastModified + "</p>" );
</script>