Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: RE: JavaScript to open in an iframe


Message #1 by Andrew Polshaw <andrewp@w...> on Wed, 17 Oct 2001 16:11:37 +0100
It's actually quite simple, unless I've misunderstood. Have your if
statement detecting the season of the year. Probably a bit of code like this
in your head:

var todaysDate = new Date();
var season;

switch (todaysDate.getMonth())
{
	case 0-2:
		season = "winter";
		break;
	case 3-5:
		season = "spring";
		break;
	case 6-8:
		season = "summer";
		break;
	case 9-11:
		season = "autumn";
		break;
}

Obviously, modify it depending on when you want the seasons to start, etc.

Then in the body have a:

document.write("<IFRAME SRC='blah" + season + "htm' ...>");

This depends, obviously, on the user's browser having the right month, etc.
You may want to localise it depending on the country. But I guess that
requires too much effort :-)


  Return to Index