Una cosa del genere?

codice:
<script>
function errore()
{
alert("Hai sbagliato!!!");
}
function A() 
{
    document.getElementById('img1').setAttribute('onclick','errore()');
    document.getElementById('img2').setAttribute('onclick','B()');
}
function B() 
{
    document.getElementById('img1').setAttribute('onclick','A()');
    document.getElementById('img2').setAttribute('onclick','errore()');
}
</script>
nella pagina html ho 2 immagini

[img]prima.png[/img]
[img]Seconda.png[/img]