Re: Display image based on date (holidays)



Yeah wrote:

I have alternate holiday headers for my web site, and I would like to display a certain image for an upcoming holiday. Examples:

    Christmas             12/10 - 12/26
    New Years Eve    12/27 - 1/2
    Halloween            10/15 - 11/1
    etc. etc.

If the date doesn't fall in any upcoming holiday ranges, then the default image is displayed.

I've scoured the Web, but not quite able to find anything. Does anyone have any pointers? Thanks!

<script type="text/javascript">
function H(){
var s=new Date();
 var isXmas=
s.getMonth()==11 && s.getDate()>9 && s.getDate()<27;

var isNewYear=
(s.getMonth()==11 && s.getDate()>26) ||
(s.getMonth()==0 && s.getDate()<3);

document.images["seasonal"].src=
isNewYear?"ny.gif":isXmas?"xmas.gif":"default.gif";
}
onload=H;
</script>

<body>
<img src="default.gif" name="seasonal">

You can work out "Halowe'en"
Mick




.