+4  A: 

Is using a timer out of the question?

document.body.style.cursor = "progress";

setTimeout(function()
{
    SortTable(cell.cellIndex, dir, sortType);
    document.body.style.cursor = "auto";
}, 10);
Greg
It's less than ideal, certainly, but I may have no other choice :(
Joel Coehoorn
I ended going this route, and here's what I found. I don't need to set the cursor. By adding the setTimeout() in there somehow the browser figures out it needs to update the cursor on it's own-- it's able to detect the function is using a lot of cpu.
Joel Coehoorn
Nevermind: that was firefox only. IE isn't that smart and Chrome finishes fast enough it doesn't need it anyway.
Joel Coehoorn
A: 

Try removing the document.body.style.cursor = "auto" and placing it into a function called at completion of your SortTable function. That way you will retain the busy cursor until the function has completed. Be sure that if you reach an error condition within SortTable() that you still hit the "No longer busy" function call.

I think you mis-read what's going on. The SortTable function blocks.
Joel Coehoorn
Yep. Definitely missed that. I see it now. And even though it looks like the answer is "Don't do this", I really wonder what's happening here. It looks like the page doesn't bother to display any changes to the style while the script is pending (I tried changing to a blue background).
+2  A: 

In web, changing mouse cursor is not conventional and not nice.

It’s much better (and easier) to use some small animations on the page itself, check http://www.ajaxload.info/ for such images (it’s an online generator).

Ilya Birman
Nice link: you'll get an upvote for it later but I'm holding back at the moment so the question stays on the unanswered view a little longer.
Joel Coehoorn
I agree that changing the cursor is bad for an ajax request. However, this is all in the DOM and can potentially use up a lot of cpu time. Changing the cursor is the traditional way to indicate that with any application. Also: progress cursor != wait cursor.
Joel Coehoorn
It depends. Changing it to a pointer is nice and conventional.
Georg
Joel, what is conventional for client apps is not for web apps. I don’t think it’s a good idea to mix those things up. User just does not expect a page to behave like this. But still, technically, your question is not answered by me answer, the other guys deserve more upvotes :-)
Ilya Birman
gs, Changing to a pointer is something that browser does, not your script. And in very rare cases you script that, you do it just to emulate the browser behaviour in case you broke it by doing something else. So I guess my point holds true ;-)
Ilya Birman