- The "date last modified on" script is ideal for websites that frequently update information for visitors. For example, a sports site that updates scores can use this Javascript code to let visitors know when the game scores were last updated. This script also adds credibility to a site by letting visitors know that it is frequently updated with new information. A stale site that never changes can turn off visitors and harm the chance of repeat visitors. Thus, automatically adding the time and date for which a Web page was last modified keeps up the appearance of freshness.
- Javascript codes are similar to HTML. They look like gibberish to the uninformed, but that is not a problem. When accurately placing the code in your website files, it works whether or not you understand the technical details of the script. The following lines of code comprise an actual Javascript to insert the date and "last modified on" message:
<SCRIPT LANGUAGE="JavaScript">
<!--
var date
date=document.lastModified
document.write("Last Modified on "+date)
// -->
</SCRIPT> - You may alter the "Last modified on" text to fit your own situation. Look inside the Javascript for those words and replace them with any message you like. For example, if you are updating stock market information, you could change it to "stock market prices last updated on." As usual, the script will automatically include the date and time for you. Make any desired text changes before placing the code in your website files.
- This "date modified on" Javascript goes inside the HTML body tags of the web page for which you want the message and date to appear. The body refers to the text that actually appears in browsers when someone visits the page. Look for the <body> and </body> tags in the HTML file and place the code in relation to the other text inside those body tags.
Purpose
Code Text
Modifying the Display
Deploying the Code
SHARE