Hola de nuevo.
Te pongo un ejemplo más completo, para cambiar la segunda imagen:
Código PHP:
<html>
<head>
<script type="text/javascript">
function cambiar() {
imagenes = document.getElementsByTagName('img');
imagenes[1].src = 'imagen2.gif';
}
</script>
</head>
<body>
<img src="imagen1.gif" />
<img src="imagen1.gif" />
<input type="button" onclick="cambiar()" />
</body>
</html>
Saludos,