I am learning javascript and I have a problem with changeimage function.
I need to change both one, and second image.
Here is jsfiddle.
https://jsfiddle.net/7ewjoxnv/1/
And here below, javascript:
var switchingImage; function changeImage() { switchingImage.src = this.value; } window.onload = function() { var radios = document.getElementById('imageSwitcher').getElementsByTagName('input'); switchingImage = document.getElementById('imageToSwitch'); for(var i=0;i<radios.length;i++) { radios[i].onclick = changeImage; } var radios = document.getElementById('imageSwitcher2').getElementsByTagName('input'); switchingImage = document.getElementById('imageToSwitch2'); for(var o=0;o<radios.length;o++) { radios[o].onclick = changeImage; } } Any help will be much appreciated.
Best Regards, David!