...

View Full Version : Wait cursor doesn't show..



sad69
04-19-2004, 11:13 PM
Hi all,

Just wondering if anyone has ever written a computational function that takes a while to run, and has ever considered changing the mouse cursor to the hourglass while the function is running.

I tried... no success. I'm not sure what I'm doing wrong either! This is essentially the format of the code -- if you know what's wrong, please let me know!



function longFunction() {
document.body.style.cursor = "wait";
...
document.body.style.cursor = "auto";
}


My code only needs to run in IE. There are no return statements within the function either.

PS. I've found that when my function fails -- so there's a Javascript error midway -- it kicks out the function, so as not to execute the line of code changing the cursor back to "auto". At this point the cursor becomes the hourglass! So it works, just not when I want it to...

Thanks in advance,
Sadiq.

glenngv
04-20-2004, 03:23 AM
Try putting a little delay.

setTimeout("document.body.style.cursor = 'wait'", 1);
...
setTimeout("document.body.style.cursor = 'auto'", 1);

sad69
04-20-2004, 05:58 PM
Nope, didn't work..

Any other suggestions? I'd really like for this to work as my clients are a bit older and seem to not have much patience. I don't think it's best if they get double clicking buttons and stuff just because it's taking long. I think the hourglass will give them a bit of a clue that they'll have to wait.

But it's not working...

Thanks,
Sadiq.

glenngv
04-21-2004, 02:28 AM
I have tested this and it works :thumbsup:


function executeFunctionWithCursor(){
document.body.style.cursor = "wait";
setTimeout("longFunction()", 1);
setTimeout("document.body.style.cursor = 'auto'", 1);
}

function longFunction() {
//long processing here
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum