It expects there to be 366 images to change to called 001.jpg, 002.jpg ... 366.jpg.
<html>
<body>
<h1>Day of Year Background</h1>
<script type="text/javascript">
var firstJan = Math.floor((new Date().setFullYear(new Date().getFullYear(),0,1))/86400000);
var today = Math.ceil((new Date().getTime())/86400000);
var dayOfYear = today-firstJan;
var bgdImage;
if((dayOfYear+'').length == 1)
bgdImage = '00'+dayOfYear+'.jpg';
else if((dayOfYear+'').length == 2)
bgdImage = '0'+dayOfYear+'.jpg';
else
bgdImage = dayOfYear+'.jpg';
document.body.style.backgroundImage=("url(\""+bgdImage+"\")");
</script>
</body>
</html>
<body>
<h1>Day of Year Background</h1>
<script type="text/javascript">
var firstJan = Math.floor((new Date().setFullYear(new Date().getFullYear(),0,1))/86400000);
var today = Math.ceil((new Date().getTime())/86400000);
var dayOfYear = today-firstJan;
var bgdImage;
if((dayOfYear+'').length == 1)
bgdImage = '00'+dayOfYear+'.jpg';
else if((dayOfYear+'').length == 2)
bgdImage = '0'+dayOfYear+'.jpg';
else
bgdImage = dayOfYear+'.jpg';
document.body.style.backgroundImage=("url(\""+bgdImage+"\")");
</script>
</body>
</html>
For articles on changing backgrounds on a daily basis or based on the season, See Daily Background Image Change or Seasonal Background Image Change here.
To change the background using Javascript see here
Changed