我有刷新功能
function refresh(nRefresh)
{
TimerSetting = document.all.curRefresh.Timer;
document.all.curRefresh.Timer = 'On';
nTimeOut = nRefresh;
updateKnlButtons();
psStatusUpdate();
}
此功能重新加载页面。 点击按钮后,我会刷新(5)以在5秒后刷新页面。由于某种原因我想在刷新功能完成后触发一个函数,但是这个函数在刷新函数完成之前被触发。如何确保在刷新函数完成后调用disable函数
function disableButton()
{
idStopSelBtn.style.cursor='wait';
idStartSelBtn.style.cursor='wait';
idBounceRunningBtn.style.cursor='wait';
idStopAllBtn.style.cursor='wait';
idStartAllBtn.style.cursor='wait';
idBounceSelBtn.style.cursor='wait'
idStopSelBtn.src='images/Button/Disabled/Stop-Selected.gif';
idStartSelBtn.src='images/Button/Disabled/Start-Selected.gif';
idBounceRunningBtn.src='images/Button/Disabled/Bounce-Running.gif';
idStopAllBtn.src='images/Button/Disabled/Stop-All.gif';
idBounceSelBtn.src='images/Button/Disabled/Bounce-Selected.gif'
idStartAllBtn.src='images/Button/Disabled/Start-All.gif';
idStopSelBtn.onclick="return false";
}
答案 0 :(得分:2)
您可以添加另一个参数(disable flag
)以获得所需的结果。
function refresh(nRefresh, disable) {
TimerSetting = document.all.curRefresh.Timer;
document.all.curRefresh.Timer = 'On';
nTimeOut = nRefresh;
updateKnlButtons();
psStatusUpdate();
if (disable) disableButton();
}
答案 1 :(得分:0)
您在寻找
吗?function refresh(nRefresh, disableButton) {
TimerSetting = document.all.curRefresh.Timer;
document.all.curRefresh.Timer = 'On';
nTimeOut = nRefresh;
updateKnlButtons();
psStatusUpdate();
disableButton();
}
function disableButton() {
idStopSelBtn.style.cursor='wait';
idStartSelBtn.style.cursor='wait';
idBounceRunningBtn.style.cursor='wait';
idStopAllBtn.style.cursor='wait';
idStartAllBtn.style.cursor='wait';
idBounceSelBtn.style.cursor='wait'
idStopSelBtn.src='images/Button/Disabled/Stop-Selected.gif';
idStartSelBtn.src='images/Button/Disabled/Start-Selected.gif';
idBounceRunningBtn.src='images/Button/Disabled/Bounce-Running.gif';
idStopAllBtn.src='images/Button/Disabled/Stop-All.gif';
idBounceSelBtn.src='images/Button/Disabled/Bounce-Selected.gif'
idStartAllBtn.src='images/Button/Disabled/Start-All.gif';
idStopSelBtn.onclick="return false";
}
refresh(5, disableButton);