single onclick event for multiple images code example
Example: javascript change multiple images onclick
<h2>Change image onClick event here...</h2>
<img src="imageName1.jpg" onmouseover="imagefun()" id="getImage">
<script>
function imagefun() {
var Image_Id = document.getElementById('getImage');
if (Image_Id.src.match("imageName1.jpg")) {
Image_Id.src = "imageName2.jpg";
}
else {
Image_Id.src = "imageName1.jpg";
}
}
</script>