How to change the MousePointer while sorting a table

S

Stefan Mueller

With
document.body.style.cursor = "wait";
I can set the hourglass and with
document.body.style.cursor = "default";
I can set the MousePointer back. That works great.

But if I do
document.body.style.cursor = "wait";
<sort the table>
document.body.style.cursor = "default";
I never see the MousePointer as a hourglass. I guess the problem is that the
MousePointer is only updated at the end of the javascript function.
Is there something like a refresh?

Stefan
 
V

VK

Stefan said:
With
document.body.style.cursor = "wait";
I can set the hourglass and with
document.body.style.cursor = "default";
I can set the MousePointer back. That works great.

But if I do
document.body.style.cursor = "wait";
<sort the table>
document.body.style.cursor = "default";
I never see the MousePointer as a hourglass. I guess the problem is that the
MousePointer is only updated at the end of the javascript function.
Is there something like a refresh?

You have to let your document a micro-break for updates:

document.body.style.cursor = "wait";
setTimeout(mySortFunction);

function mySortFunction() {
....
....
document.body.style.cursor = "default";
}
 
T

Thomas 'PointedEars' Lahn

VK said:
You have to let your document a micro-break for updates:

document.body.style.cursor = "wait";
setTimeout(mySortFunction);

Since when is the second argument of setTimeout() an optional one?
And using a function reference will indeed _break_ or not work in
older UAs, especially older IEs.
function mySortFunction() {
...
...
document.body.style.cursor = "default";
}


PointedEars
 
V

VK

Thomas said:
Since when is the second argument of setTimeout() an optional one?

Since always. It ensures the minumum time period available at the given
system (1 system tick) w/o needs to worry about the particualr system
type (Win98 ... Win XP, Mac, Linux)
And using a function reference will indeed _break_ or not work in
older UAs, especially older IEs.

The oldest IE still officially supported by Microsoft (and available
for download) is IE 5.5 SP2 for Windows. Any older IE's (as well as
IE's for Mac) are out of practical interest for anyone including
myself. It doesn't prevent personal proprietary choices (like you are
welcome to make NN 3.0 Gold - compliant solutions) but it is not a
subject of public consideration.
 
T

Thomas 'PointedEars' Lahn

VK said:
Since always. It ensures the minumum time period available at the given
system (1 system tick) w/o needs to worry about the particualr system
type (Win98 ... Win XP, Mac, Linux)

Neither Netscape, which invented this method, nor Microsoft or the Mozilla
Organization and other implementors which copied the implementation, agree
with you:

<URL:http://e-pla.net/documents/manuals/javascript-1.0/ref_s-s.html#setTimeout_method>
<URL:http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/ref_s-s.htm#73328>
<URL:http://research.nihonsoft.org/javascript/jsref/win1.htm#1012029>
<URL:http://research.nihonsoft.org/javascript/ClientReferenceJS13/window.html#1203758>
<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/settimeout.asp>
<URL:http://developer.mozilla.org/en/docs/DOM:window.setTimeout>
<URL:http://developer.kde.org/documentation/library/3.4-api/khtml/html/classKJS_1_1ScheduledAction.html>
The oldest IE still officially supported by Microsoft (and available
for download) is IE 5.5 SP2 for Windows.

Nevertheless my grandmother can use her Windows 98 SE with built-in IE 5.01
quite well. You do not want to force her (and the numerous other people
who do not want or cannot upgrade) to upgrade, do you?
Any older IE's (as well as IE's for Mac) are out of practical
interest for anyone including myself.

So you do not want my grandmother (and numerous other people that do not
want to or cannot upgrade) to buy stuff provided by you or your clients?
You deliberately want to decrease the profit margin for you or your
clients? Maybe there is something about selling you did not understand
properly yet.
It doesn't prevent personal proprietary choices (like you are
welcome to make NN 3.0 Gold - compliant solutions) but it is
not a subject of public consideration.

Not for incompetent people like you, that is for sure.


PointedEars
 
S

Stefan Mueller

First of all thanks a lot for your solution. Until now it's still the only
solution I have and if it works then setTimeout is okay for me. But it
doesn't really work yet.

<html>
<body>
<script type = 'text/javascript'>
/*-------------------------------------------*/
function sorttable(var_text, var_number) {
document.body.style.cursor = "wait";
window.setTimeout("do_sorttable()", 1);
// window.setTimeout("do_sorttable(var_text, var_number)", 1);
}
/*-------------------------------------------*/
function do_sorttable() {
// function do_sorttable(var_text, var_number) {
for (i = 1; i < 2000000; i++) {
}

alert("Done.");
document.body.style.cursor = "default";
}
</script>

<input type = 'checkbox' name = 'my_ckeckbox' onClick =
'sorttable("abc", 123)'>
In Mozilla and Opera the MousePointer is only on this text an
hourglass and in Mozilla only after the alert box. Why that and how can I
solve that problem?
</body>
</html>


In Mozilla and Opera the MousePointer is not on the whole window an
hourglass and in Mozilla only after the alert box. Why that and how can I
solve that problem?

My second problem is that if I use
window.setTimeout("do_sorttable(var_text, var_number)", 1);
and
function do_sorttable(var_text, var_number) {
it doesn't work at all (Error: 'var_text' is undefined.

Stefan
 
R

Randy Webb

Thomas 'PointedEars' Lahn posted the following on 1/25/2006 11:14 AM:
VK wrote:


Nevertheless my grandmother can use her Windows 98 SE with built-in IE 5.01
quite well. You do not want to force her (and the numerous other people
who do not want or cannot upgrade) to upgrade, do you?

The same argument could be used for NN4 users then but I don't see you
professing to want to support NN4 though. Somewhere, you have to draw
the line on how far back you want to support a family of browsers.
Personally, IE5.5 is too old to be considered current and should be
dropped. IE5.0 goes without saying.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top