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