print on your page when it was last modified
Conventions: When a portion of code is a different color,
the text that is of the same color references that code.
"This page" and any relevant files can be downloaded on the previous page by clicking the green disk next to the link that brought you to this page.
Test this page
Try making any modifications to this page. Then save it. Run
it in your browser and the "last modified" date will be updated
The HTML portion
To see how it works, study the information between the SCRIPT and /SCRIPT tags in the HTML. This line tells the browser to load a separate script file (lastupdate.js) into the page and runs it at the point in the page where the SCRIPT tag exists.
Tells the browser that a script is
to be interpreted, end of script interpretation
Tells the browser where to load the script file from. You could simple embed the script file into your HTML but that would: 1. be more difficult to modify 2. be more difficult to understand 3. allow the user to see the "source" of the script, something you may not want to do.
color='#CCCCCC' size='2'> <font color='#0080C0'>this page last modified
document.write("<font color='#0080C0'><strong><font size='2'>");
and double quotes in a document.write statement will write to the document.
You can even write HTML code to the page, as shown here.
All of this is normal HTML code, and formats the text that is being written
This is the line that does it all. The 'document' is your page. The document is called an object. Each 'item' on your page is also an object. Objects have properties (characteristics) and methods (ability to do carry out an action). In this line, we are using the document method 'document.write' to write the document's 'lastModified' property to the page.
upper and lower case is IMPORTANT!
you SHOULD ALWAYS end each statement with a semicolon (;). Some browsers do not require them, but you will find that if you do not use them, you will run into hard-to-detect errors as well as confusing some browsers.