Hello I need bit of help I am trying to use javascript to change the website background image on the start of each month So far I have this in between the head tags [COLOR=#000000][FONT=monospace]<script>[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]/*[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]SM_dailyBgColor()[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]This function automatically changes the page's background color each day of the week.[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]Usage: SM_dailyBgColor ("januarycolor", "februarycolor", "marchcolor", "aprilcolor", "maycolor", "junecolor", "julycolor", "augustcolor", "septembercolor", "octobercolor", "novembercolor", "decembercolor"); [/FONT][/COLOR] [COLOR=#000000][FONT=monospace]*/[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]function SM_dailybg(january,february,march,april,may,june,july,august,september,october,november,december)[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]{[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols=new Object();[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[0]=january;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[1]=february;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[2]=march;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[3]=april;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[4]=may;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[5]=june;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[6]=july;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[7]=august;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[8]=september;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[9]=october;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[10]=november;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]cols[11]=december;[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]today=new Date();[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]day=Math.round(today.getMonth());[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]document.bgColor=cols[day];[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]document.body.style.background=cols[day];[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]}[/FONT][/COLOR] [COLOR=#000000][FONT=monospace]</script>[/FONT][/COLOR] Code (markup): And the below in between my body tags [COLOR=#000000][FONT=monospace]<body onLoad='SM_dailybg("images/1.jpg", "images/background.png", "images/1.jpg", "images/background.png", "images/1.jpg", "images/background.png", "images/1.jpg","images/background.png","images/1.jpg","images/background.png","images/1.jpg","images/background.png");'[/FONT][/COLOR] Code (markup): Can some please help me and point me in the right direction to get it to work Kind regards Ian
If you name the image files 0.png to 11.png and 0.jpg to 11.jpg, you can just get the current month [day=Math.today.getMonth();] and build the file name.