By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

How to change the MousePointer while sorting a table

P: n/a
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
Jan 24 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
VK

Stefan Mueller wrote:
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";
}

Jan 25 '06 #2

P: n/a
VK wrote:
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
Jan 25 '06 #3

P: n/a
VK

Thomas 'PointedEars' Lahn wrote:
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.

Jan 25 '06 #4

P: n/a
VK wrote:
Thomas 'PointedEars' Lahn wrote:
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)


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>
<URL:http://webcvs.kde.org/khtmltests/ecma/settimeout.html?rev=1.2&view=auto>
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.


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
Jan 25 '06 #5

P: n/a
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
Jan 25 '06 #6

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


<snip>
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.


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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 25 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.