Changing Image Source in Javascript
This project will teach how to change image source using basic javascript code. onClick event, image will automatically change. Here's the full code. var img_tracker = 'chrome'; function changeImg(){ var image = document.getElementById('browser'); if(img_tracker == 'chrome'){ image.src = 'images/firefox.jpg'; img_tracker = 'firefox'; }else{ image.src = 'images/chrome.jpg'; img_tracker = 'chrome';