This functionality actually requires (embedded) JavaScript. I'd ordinarily create a piece of discrete JavaScript to do something like this, but....
<img src="img1.jpg" onclick="(this.src.indexOf('img1.jpg') >=0) ? this.setAttribute('src','img2.jpg') : this.setAttribute('src','img1.jpg');;">
Good thing I tested this a bit. It turns out you can't just test for equality here when the 'src' attribute is set to a relative URL. Firefox converts it into a complete URL in my testing. So I used indexOf as a workaround, but it's probably not best practice. Someone else might chime in with a better solution.