Changing the 'src' attribute of an image using javascript <p>I'm using javascript, so that when a refresh button is clicked it begins to spin around until the refresh is completed. This is my function:</p> <pre><code>function RefreshHome() { // Refreshes the home page via the image link. // Make the refresh link animate. var refresh = document.getElementById("refresh_button"); refresh.src = "images/refresh_animated.gif"; // Refresh the page. window.location = "home.aspx"; return false; } </code></pre> <p>This worked perfectly for a while then, as far as I can see, inexplicably stopped working! When the refresh button is clicked on now, the image just disappears.</p> <p>Does anybody know why this might happen?</p>