... essere piuttosto semplice:

codice:
<script language="JavaScript"> 

alt1 = new Image(); 
alt1.src = "img/panda1.gif"; 

alt2 = new Image(); 
alt2.src = "img/panda2.gif"; 

alt3 = new Image(); 
alt3.src = "img/panda3.gif"; 

n=1; // il nostro contatore

function imageChange(imageID,imageName,azione) { 
if ((azione=="avanti") && (n<3)) n++;
else if ((azione=="indietro") && (n>1)) n--;
imageName+=n;
document.images[imageID].src = eval(imageName + ".src");
} 
</script>
La chiamata però diventa:

codice:
<input type="button" onClick="imageChange('panda','alt','avanti');" value="Avanti">
<input type="button" onClick="imageChange('panda','alt','indietro');" value="Indietro">
Ciao !