How to set cursor wait when calling a function?

I have a function in my page, that orders a HTML table with Javascript by changing the row positions. When the table is big, the ordering takes some seconds and I would like the cursor to go hourglass.

I've tried to call:
     document.body.style.cursor="wait";

but the cursor only goes hourglass after the function has finished.
RobertoTYAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Michel PlungjanConnect With a Mentor IT ExpertCommented:
Why? WHat are you trying to do?

Anyway

lastEvent = "";
function doIt()
  document.body.style.cursor="wait";
  lastEvent = event;
  setTimeout('realFunction()',100);
}

function realFunction(){
   lastEvent.srcElement...
.
.
.
.
  document.body.style.cursor=...
}
0
 
Michel PlungjanIT ExpertCommented:
function doIt()
   document.body.style.cursor="wait";
   setTimeout('realFunction()',100);
}

function realFunction(){
.
.
.
.
   document.body.style.cursor=...
}
0
 
RobertoTYAuthor Commented:
about the last comment:

Using this, I will face another problem.
Inside the real function I'll have to call event.srcElement inside the "real function".

It doesn't work if I use setTimeout.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
RobertoTYAuthor Commented:
about the last comment:

Using this, I will face another problem.
Inside the real function I'll have to call event.srcElement inside the "real function".

It doesn't work if I use setTimeout.
0
 
RobertoTYAuthor Commented:
function sortColumn(pDescending)
{
  document.body.style.cursor="wait";
  setTimeout('realFunction',100);
}

function realFunction() {
   var tmp, el, tHeadParent,pDescending;
   
   if (ie5)
      tmp = window.event.srcElement ;
   else if (dom)
      tmp = window.event.srcElement;

   tHeadParent = getParent(tmp, "THEAD");

   el = getParent(tmp, "TD");
   

An error occurs when the call to srcElement property is made.
0
 
Michel PlungjanIT ExpertCommented:
Try it my way then

Michel
0
 
COBOLdinosaurCommented:
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&
0
 
Michel PlungjanIT ExpertCommented:
Points, please
0
 
COBOLdinosaurCommented:
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to mplungjan

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
 
Computer101Commented:
Comment from expert accepted a answer

Computer101
E-E Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.