[Javascript] javascript autodate question (with code)

Dave schemer at cyou.com
Tue Jan 8 11:23:27 CST 2002


I have added the following code to my webpage to automatically display
the date my page was last updated. It seems to work in my html editor
(homesite 4.x) using the internal browser (IE) and updates the date on
the screen just fine. The problem is that it doesn't seem to work online

with either IE or NN 4.79 and the date remains the same even if I reload

the page etc..I also notice some code added to my html page when viewing

the source online: <BASE HREF="http://www.myserver/mydirectory/"> that
is not in the code I created and sent to my server. What could cause all

this??
Thanks,
Dave K.

oops, forgot the code! Here it is:
<script language="JavaScript" type="text/javascript">

<!--
var text = ""
monthstr = new Object();
monthstr[0] = "Jan"
monthstr[1] = "Feb"
monthstr[2] = "Mar"
monthstr[3] = "Apr"
monthstr[4] = "May"
monthstr[5] = "Jun"
monthstr[6] = "Jul"
monthstr[7] = "Aug"
monthstr[8] = "Sep"
monthstr[9] = "Oct"
monthstr[10] = "Nov"
monthstr[11] = "Dec"
var now = new Date(document.lastModified)
var month = now.getMonth()
var date = now.getDate()
var year = now.getYear()
var hour = now.getHours()
var min  = now.getMinutes()
if (year < 100) year += 2000;

if (year < 1000) year += 1900;
now = null
document.write("<br>Last updated: " + date + "-" + monthstr[month] + "-"

+ year)
//-->

</script>




More information about the Javascript mailing list