PHP Code:
<html>
<head>
</head>
<script type="text/javascript">
function selecthair() {
var images = new Array();
images[0] = "img2.png";
images[1] = "img3.png";
var imagesCount = 0;
if(imagesCount == 2) {
imagesCount = 0;
}
document.getElementById("hair").src = images[imagesCount];
document.getElementnById("hair").value = imagesCount;
imagesCount++;
}
</script>
<body>
<img id="hair" src="img1.png" value="0">
<input type="submit" value="Bild wechseln" onclick="javascript:selecthair();">
</body>
</html>