Image changing every day of the year (365 days)
<p>I need a little help with my code there are 366 images to change called 001.jpg, 002.jpg ... 366.jpg. It gets the date and put the picture for it. The code works but I can't get it to output in my img tag.</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;

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.getElementById('bla').src = "bgdImage";
&lt;/script&gt;

&lt;/head&gt;
&lt;body onload=img()&gt;

&lt;img id="bla" width="100%" height="100%" /&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
