2013-08-07 58 views
0

我有一個代碼,當單擊圖像時將等待光標放在所有圖像上。光標的樣式不變

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' 
} 

當點擊按鈕調用的函數獲取時,我設計了另一個函數來取走等待光標並放置默認光標。

function enableButton(strType) 
{ 
idStopSelBtn.style.cursor='default'; 
idStartSelBtn.style.cursor='default'; 
idBounceRunningBtn.style.cursor='default'; 
idStopAllBtn.style.cursor='default'; 
idStartAllBtn.style.cursor='default'; 
idBounceSelBtn.style.cursor='default'; 
alert('done'); 
} 

等待標誌仍然沒有調用這個function.I剛添加警報後,要檢查功能發射或不和它的射擊,仍光標跡象沒有改變。

+0

你是如何調用這個第二個函數?創建一個jsfiddle將有助於我們更好地理解這個問題。 –

回答

-1

這就是你需要的。

idStopSelBtn.Attributes.Add("onclick", "document.body.style.cursor = 'wait';"); 

如果我錯了,請糾正我。我不是一個.NET開發人員,我想這是.NET代碼,我們的團隊在做這樣的...

我希望它可以幫助...

編輯它,只要你想。而不是直接的CSS代碼本身調用一個js函數,並繼續默認並在那裏等待光標操作。

+0

爲什麼要投票? – Akki619

0

嘗試將其設置爲自動,而不是默認:

function enableButton(strType) { 
    idStopSelBtn.style.cursor='auto'; 
    idStartSelBtn.style.cursor='auto'; 
    idBounceRunningBtn.style.cursor='auto'; 
    idStopAllBtn.style.cursor='auto'; 
    idStartAllBtn.style.cursor='auto'; 
    idBounceSelBtn.style.cursor='auto'; 
    alert('done'); 
}