Javascript Month/Date Loading, plz help

I have a website with all of the months of the year. The main page of the website is suppose to be the current month. How can make my index page load automatically to the correct month. So if it is April, my index page will automatically load april.html.
Thank you so much!

<script language="JavaScript">
<!-- Hide from older browser
var x= new Date();
var m= x.getMonth()+1  ;
document.location.href =" + m + .html";

You can also use a switch:

<script type="text/javascript">
var dateobj=new Date()
var month=dateobj.Month() + 1;
case 1:
case 2:
case 3:
case 4:


The best way to do that would be with server side scripting - that way the correct page will load for all the people with javaScript disabled or not available as well as those where it is available.

You should be more specific about which browsers you are hiding the script from when you include that code.

The older browsers it refers to are Internet Explorer 2, Netscape 1, and the browsers that preceded them.

The comment doesn’t hide the script from Internet Explorer 3 or Netscape 2 or more recent browsers than those.

At the current rate of browser development it should be possible to do away with such comments once everyone stops using Netscape 1 and IE2 - which will most likely happen long before the end of the 20th century - say 1998 to play it safe.

Alright man, I’m not the best at JS, but regardless off the comments I added, to hide from older browsers, the rest will still work. Just giving the guy a jump-start, which he can build from. Not a copy-and-paste. However, I didn’t take into account using a server-side solution, as this post is in the JS Forum.

wow thank you so much! I used the first example and i have another question. I know this is the JS forum but how do I make a html file open another html file in the same directory?