anzichè mettere il link da solo aggiungi una cosa casuale dopo ?
http://localhost/immagine.png?23193
http://localhost/immagine.png?43907
Così, essendo il link diverso, il browser penserà che l'immagine cambia ma in realtà tutto quello che c'è dopo ? non viene considerato dal server.
Per generare il numero puoi usare
Codice:
function getRandom(min, max) {
return (Math.round(Math.random()*(max-min)))+min;
}
function refreshImage() {
document.getElementById("id_immagine").src="http://localhost/immagine.png?"+getRandom(10000,99999);
}