Put a last updated text on your web site

From The IT Community
Jump to: navigation, search

If you update your website regularly, it is always a good idea to let your visitors know when the last update took place.

So here is how to put a "last updated" text on your web site using JavaScript:

To do so put the following code in the <head>-section of your website:

<script type="text/javascript">
onload = function(){
   document.getElementById("lastModified").innerHTML = "Page last changed " + document.lastModified.split(" ")[0];

and then in the <body>-section put this:

 <font color="#666666" size="-2"><span id="lastModified"></span></font>

Of course, you can use any font you prefer, I just like to keep such things small and non-distracting.

Was this article helpful? Then please donate to keep The IT Community alive...

If you found this article helpful please share it, comment and help others by writing your own article.

Translate this page:

Articles found in the same category:
(max. 20 shown)