How to change the MousePointer while sorting a table

Discussion in 'Javascript' started by Stefan Mueller, Jan 24, 2006.

  1. 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
     
    Stefan Mueller, Jan 24, 2006
    #1
    1. Advertising

  2. Stefan Mueller

    VK Guest

    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";
    }
     
    VK, Jan 25, 2006
    #2
    1. Advertising

  3. 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
     
    Thomas 'PointedEars' Lahn, Jan 25, 2006
    #3
  4. Stefan Mueller

    VK Guest

    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.
     
    VK, Jan 25, 2006
    #4
  5. 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
     
    Thomas 'PointedEars' Lahn, Jan 25, 2006
    #5
  6. 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
     
    Stefan Mueller, Jan 25, 2006
    #6
  7. Stefan Mueller

    Randy Webb Guest

    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/
     
    Randy Webb, Jan 25, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SW1yYW4=?=

    mousepointer in webform

    =?Utf-8?B?SW1yYW4=?=, Mar 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    416
    =?Utf-8?B?SW1yYW4=?=
    Mar 6, 2004
  2. Steve C. Orr [MVP, MCSD]

    Re: Changing MousePointer

    Steve C. Orr [MVP, MCSD], Jul 21, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    508
    Steve C. Orr [MVP, MCSD]
    Jul 21, 2004
  3. Ellie

    mousepointer in javascript

    Ellie, Oct 22, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    290
    Ellie
    Oct 22, 2008
  4. jef
    Replies:
    1
    Views:
    126
    Eliyahu Goldin
    Apr 12, 2005
  5. Stefan Mueller

    How to change the overall mousepointer?

    Stefan Mueller, Dec 15, 2009, in forum: Javascript
    Replies:
    12
    Views:
    238
    Thomas 'PointedEars' Lahn
    Dec 16, 2009
Loading...

Share This Page