angeliq
09-05-2006, 06:35 PM
I'm a total n00b with java scripts but I need one for mt personal site.Namely,it's a script that changes an image 4 times a year,this is the script I need help with:
<script language="JavaScript">
var pics=new Array();
pics[0]="images/ winter.gif";
pics[1]="images/ spring.gif";
pics[2]="images/ summer.gif";
pics[3]="images/ fall.gif";
var UW_Date=new Date();
var d=UW_Date.getDate();
var m=UW_Date.getMonth()+1;
var s;
if(m>1&&m<=3)s=0;
else if(m==3&&d>19)s=1;
else if(m>3&&m<=6)s=1;
else if(m==6&&d>20)s=2;
else if(m>6&&m<=9)s=2;
else if(m==9&&d>21)s=3;
else if(m>9&&m<=12)s=3;
else if(m==12&&d>20)s=0;
document.write('<img src="' + pics[s] + '">');
</script>
*BOLD - I know that these are the dates that define when the image changes but I don't really get what is what here.If anyone could help me with,if I for example needed the scripts to change the images on the following dates:
September 5th
October 6th
November 8th
Decemberr 9th
Thanks in advance :o
<script language="JavaScript">
var pics=new Array();
pics[0]="images/ winter.gif";
pics[1]="images/ spring.gif";
pics[2]="images/ summer.gif";
pics[3]="images/ fall.gif";
var UW_Date=new Date();
var d=UW_Date.getDate();
var m=UW_Date.getMonth()+1;
var s;
if(m>1&&m<=3)s=0;
else if(m==3&&d>19)s=1;
else if(m>3&&m<=6)s=1;
else if(m==6&&d>20)s=2;
else if(m>6&&m<=9)s=2;
else if(m==9&&d>21)s=3;
else if(m>9&&m<=12)s=3;
else if(m==12&&d>20)s=0;
document.write('<img src="' + pics[s] + '">');
</script>
*BOLD - I know that these are the dates that define when the image changes but I don't really get what is what here.If anyone could help me with,if I for example needed the scripts to change the images on the following dates:
September 5th
October 6th
November 8th
Decemberr 9th
Thanks in advance :o