I have one very simple Javascript code. The code is to change the source of the image when the page loads. It goes something like this:
window.onload = initAll;
function initAll(){
document.getElementById("imgSlider").src = "menuBack.jpg";
}
Now, this works perfectly fine. Look at the code below.
window.onload = initAll;
function initAll(){
var imgSrc = document.getElementById("imgSlider").src
imgSrc = "menuBack.jpg";
}
Shouldn't this code perform as the code above? I guess, it should. Is there something wrong in the lower code? I use Mozilla Firefox(latest version). Could this be the problem of the browser?