Forum Moderators: open

Message Too Old, No Replies

Changing the Cursor with Javascript

While page is fetching AJAX stuff.

         

brotherhood of LAN

5:06 am on May 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm often using AJAX in an admin area, and would like the cursor to indicate when AJAX stuff is being fetched.

function ajaxFunction()
{
document.body.style.cursor = 'wait';
// ajax stuff here, takes a few seconds
document.body.style.cursor = 'default';
}

I can't seem to get this working for me, the cursor does not change at all. I've googled around a bit and always find the same code. (Firefox 3.5.8 on Ubuntu 9.10). I have no CSS declarations for the cursor.

Any 'pointers' in the right direction?

TheMadScientist

7:19 am on May 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you have the second change inside the onreadystatechange function or in the main function? If it's not in the onreadystatechange function it's probably switching right back to normal. I did just test it in FF on a site I'm working on right now, and the code worked, so my best guess is it's switching and then switching right back.

brotherhood of LAN

8:05 am on May 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You are dead right, thanks for that.