You are here: irt.org | FAQ | JavaScript | Image | Q458 [ previous next ]
By comparing the current date:
<script language="JavaScript"><!-- function y2k(number) { return (number < 1000) ? number + 1900 : number; } function padout(number) { return (number < 10) ? '0' + number : number; } var today = new Date(); var year = y2k(today.getYear()); var month = padout(today.getMonth()+1); var day = padout(today.getDate()); var today = '' + year + month + day; var image = 'default.gif'; if (today == '19982507') image = 'anynameinhere.gif'; else if (today == '19982607') image = 'anothername.gif'; else if (today == '19982707') image = 'anothername2.gif'; // ad nauseum document.write('<img src="' + image + '" height="100" width="100"'); //--></script>