Solved

XMLHTTP and Hourglass Cursor

Posted on 2001-07-07
5
531 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now