Let's say I have a javascript method that takes a little time to finish work without any user feedback. In my case, sorting the rows in a table element (everything in the DOM, takes too much time if there are too many rows), but it can do anything. I want to show the cursor "progress" during its launch. Here is what I mean right now, but I also tried a few other things:
document.body.style.cursor = "progress";
MyLongRunningMethod();
document.body.style.cursor = "auto";
Unfortunately, nothing happens. MyLongRunningMethod () does it right, but the cursor never changes. My idea is that the browser needs to wait for the method to return in order to be able to process the cursor change message generated by the window environment, but this can be far away, and even if it's true, I don’t know how to fix it.
Any other ideas?
[edit]: I decided that everything I had was not really necessary. If you really want to read it, check the change history.
End results
I ended up using the RoBorg solution. This will not mess up the code as much as I originally thought, because I can save the function declared there - it's just adding an inline visibility block.
, Firefox , , . , , setTimeout, , , , . , - setTimeout click FireFox , . , IE , .
, — , . DOM (, - ) , . script , .
, Chrome . , Chrome 5 , IE Firefox 10 15 . javascript . Firefox 3.1. , IE6.