[WEB4LIB] date last modified script?

Carl Snow csnow at purdue.edu
Wed Feb 9 08:51:47 EST 2000


We are using this script.

<!-- Hide me from old browsers

function MakeArray(n) {

    this.length = n;
    for (var i=0; i<= n; i++) {
	this[i] = 0;
    }
    return this;
  }
    months = new MakeArray(11)

	months[0] = "January"
	months[1] = "February"
	months[2] = "March"
	months[3] = "April"
	months[4] = "May"
	months[5] = "June"
	months[6] = "July"
	months[7] = "August"
	months[8] = "September"
	months[9] = "October"
	months[10] = "November"
	months[11] = "December"

	update=new Date(document.lastModified)

	theMonth = months[update.getMonth()]

	theDate = update.getDate()

	theYear = update.getFullYear()

	if (theYear < 2000)
		theYear = theYear +100

	document.writeln('<FONT SIZE="-1" COLOR="#660000"> URL:
http://www.lib.purdue.edu/ <BR> Last update:  ',theMonth, " ",theDate,",
",theYear,  '</FONT>' )

// End Hiding-->

This is placed in a file called update.js (you can name it anything).

We then reference the script from our html pages with this call

<SCRIPT LANGUAGE="JavaScript" SRC="http://[host machine
www.xxx.yourorg.edu]/update.js"></SCRIPT>

Replace the text in the square brackets with your host name.

This works well for most browsers.  Netscape 3.x has trouble with
referencing external JavaScript.  If you are concerned about that then
insert the actual JavaScript into your pages.

Carl Snow
Network Access Librarian
Purdue University



-----Original Message-----
From: web4lib at webjunction.org
[mailto:web4lib at webjunction.org]On Behalf Of Mariner, Vincent A.
Sent: Wednesday, February 09, 2000 8:38 AM
To: Multiple recipients of list
Subject: [WEB4LIB] date last modified script?


Hello folks,

Can anyone point me to a date last modified script?   The one I currently
use is not working correctly in Netscape Communicator.

Here's the current scipt:

  <SCRIPT TYPE="text/javascript"> var theDate = ""
  theDate = document.lastModified
  document.writeln("Last Updated: ");
  document.write(theDate);
  document.write();
  </SCRIPT>

and here is what it produces in Netscape Communicator:

Last Updated: Wednesday, December 31, 1969 20:00:00

Works just fine in I.E. 5

As I looked for a script, I noticed that many people are not using scripts
for this purpose.  Is this more appropriate, common, a trend, etc.?

Thanks,
Vince



More information about the Web4lib mailing list