0
我正在使用javascript,因此當單擊刷新按鈕時,它將開始旋轉,直到刷新完成。這是我的功能:使用javascript更改圖像的'src'屬性
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;
}
這工作完美了一段時間,據我所知,莫名其妙地停止工作!當點擊刷新按鈕時,圖像就會消失。
有人知道爲什麼會發生這種情況嗎?
謝謝 - 在編寫這個函數的時候,該網站並沒有使用jQuery,但是我們已經添加了它,並且發現它很棒,舊的習慣正在變得很難,我想我會繼續寫document.getElementById! – surfitscrollit 2012-03-15 09:26:53
我厭惡學習它,因爲我沒有看到這一點,但它是非常有用的,並且很容易,如果你對純js感到舒服 – 2012-03-15 09:27:47
另外 - 它沒有顯示與點擊之前的X, src屬性是「images/refresh_stationary.png」 – surfitscrollit 2012-03-15 09:28:52