JavaScript: Adding a Date Stamp
Jack Donnell,
[email protected]
Looks like every web page has a Date Stamp on it. A pretty handy trick for most any page. It almost makes the viewer think that the page was recently updated. Play around sometime and load a page with a date stamp, then change your system clock and reload it. Trash In. Trash Out.
The code is pretty simple to follow. You can add color and change the font and positioning with <p align="center"></p>(<center></center> will work, too) and <font face="Arial" size="3' color="></font> tags at both ends of your <script></script> tags.
Okay, my coding is not pretty. I did not add any browser checks and what not. I'm bad..very bad. I just wanted to show you how the write this bit of code into your pages. I use this bit of code a lot. Mostly, as a call from an external *.js file. I'm pretty lazy when I code and this keeps me from having to cut and paste or retype a script. There are some downfalls and I go better into some of them in External JavaScripting.
The sample code bellow is in it's elementary form and will write the date stamp to your page. You can just cut and paste it into a text file with the htm or html extensions and it should work, but remember that you can put this most anywhere on your page and format it anyway you like it. So, play around with it. I did put some extra notes in the code behind the //'s. Biggest thing to rememeber is the Day, Month and any Arrays for that matter must be typed on only one line. Line Breaks in an array prevent the entire script from working.
BLAH..BLAH.. I know..Hush Up and Give you the code. Here it is.
SOURCE CODE
// -->
</script> </body> </html>