简体   繁体   中英

Style of cursor is not changing

I have a code to put a wait cursor on all the images when a image is clicked.

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

When the function called by clicking of button gets I designed another function to take away wait cursor and put default cursor.

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

The wait sign is still not going after calling this function.I just added alert to check if the function is firing or not and it's firing, still cursor sign is not changing.

try setting it to auto instead of default:

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

This is what you need.

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

Please correct me if I am wrong. I am not a .net developer and I guess this is .net code and our team is doing like this...

I hope it may help...

EDIT it as you want. Instead of putting direct css code there itself call a js function and proceed with default and wait cursor manipulation there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM