what's wrong with this...

Giganews Newsgroups
Subject: what's wrong with this...
Posted by:  Ross Levis (ro…@stationplaylist.dot.com)
Date: Sat, 12 Jul 2003

I wrote some javascript code a couple of years ago to load a web page based
on the current date & time.  I just modified it today to change the naming
format of the web pages and I can't get it to work at all.  Even the old one
which was working (on Win98) is not working at all on my WinXP Pro.  Has
some new requirement been introduced?

Can anyone see what's wrong with the following code.  If it is 9am on July
12, it should load a web page named: Jul12-09.html, but it does nothing at
all.

<html>
<head>
<script language="JavaScript">
<!--
function lp() {
  ms=new Array(11);
  ms[0]="Jan";
  ms[1]="Feb";
  ms[2]="Mar";
  ms[3]="Apr";
  ms[4]="May";
  ms[5]="Jun";
  ms[6]="Jul";
  ms[7]="Aug";
  ms[8]="Sep";
  ms[9]="Oct";
  ms[10]="Nov";
  ms[11]="Dec";
  dt=new Date();
  m=dt.getMonth();
  d=dt.getDate();
  d=(d<10)?"0"+d:d;
  h=dt.getHours();
  h=(h<10)?"0"+h:h;
  location.href=ms[m]+d+"-"+h+".html";
}
//-->
</script>
</head>
<body onload="lp()"></body>
</html>

Thanks,
Ross Levis.

Replies