Solved

XMLHTTP and Hourglass Cursor

Posted on 2001-07-07
5
542 Views
Last Modified: 2008-03-10
Ok, Basically upon an onClick, in a javascript function I do:

document.body.style.cursor = "wait";
<some long xmlhttp post which takes 5 seconds or so>
document.body.style.cursor = "auto";

The problem is the cursor doesn't change to an hourglass fast enough. The XMLHTTP post is already executing way before it has a chance to change.
I read somewhere that the user has to move the mouse in order for it to change.
Well since the odds of a mouse move in the SPLIT SECOND between the change and the xmlhttp post begin is low, I need a faster method of changing the cursor.

Putting in a delay is out of the question.
Doesn't the XMLHTTP object have any sort of built in hourglass ability?
Are you able to move the cursor with javascript? I wouldn't mind moving it a pixel somewhere to see if that will change it to the hourglass right away (I'd rather not but, if thats what needs to be done)

Any ideas?
0
Comment
Question by:Sembiance
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:mattyk
ID: 6262450
Yes unfortunatly you will usually need to move the mouse to trigger the cursor to change.  However another solution I have found is to blur and then focus back on the window object.  A quick example would be:

<body>
<script>
function testing()
{
     document.body.style.cursor = 'wait'
     window.blur();
     window.focus();

}

</script>
<a onclick="testing()">Test Link</a>

</body>

-matty
0
 

Author Comment

by:Sembiance
ID: 6262874
Sigh... I tried that and it didn't work.
All that happens now is almost the entire webpage disappears while the request takes place and then reappears after its done.

By the way  90% of the webpage is dynamically retrieved via XMLHTTP objects and so not much stays on the screen during a blur/focus.

What else can I do?
0
 
LVL 5

Accepted Solution

by:
mattyk earned 100 total points
ID: 6262921
Would you be open to using a small pop window that opens when the loading starts and then closes once things are done?
0
 

Author Comment

by:Sembiance
ID: 6273337
Not really. Anything visually noticable is not an option. I really need it to be seamless.

But maybe its not just possible.

I know I don't want to introduce an insecure active-x control just to allow the cursor to change.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6867168
Finalized by EE Moderator
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question