You can change the property src
using an identifier or something you can select from the image. Then you can retrieve the node from it with javascript and edit any attribute.
Example:
var
// Armazena o nó da imagem.
image = document.getElementById('id-da-imagem'),
// Recupera um objeto com o momento atual.
date = new Date(),
// Recupera o mês do objeto "date".
month = date.getMonth(),
// Recupera o dia do objeto "date".
day = date.getDate();
// Altera o source da imagem armazenada.
image.src = '/img/' + month + '/' + day + '.jpg';
If you want to exchange the attribute with jQuery:
var
// Recupera um objeto com o momento atual.
date = new Date(),
// Recupera o mês do objeto "date".
month = date.getMonth(),
// Recupera o dia do objeto "date".
day = date.getDate();
// Altera o source da imagem armazenada.
$('#id-da-imagem').attr('src', '/img/' + (month < 10 ? '0' + month : month) + '/' + (day < 10 ? '0' + day : day) + '.jpg');
See this application example in jsFiddle: http://jsfiddle.net/n28gk/1/
And the date goes where? Would be able to show an example?
– peterq
Careful, javacript always takes the local value of the machine so if it is wrong the machine you will end up bringing wrong image.
– LucasMoura
Or if your computer is in a different time zone than the server (which may be a bug or a Feature, depending on your intention).
– mgibsonbr
@karmex this proposed script will affect the image with id='test' in html.
– Bacco