javascript change multiple images onclick
snippet in javascript

javascript change multiple images onclick

user6558

		<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>