Hour Glass Cursor not appearing

Discussion in 'Javascript' started by Aaron Gray, Jan 3, 2007.

  1. Aaron Gray

    Aaron Gray Guest

    Hi,

    I am doing some JavaScript calculations that can take up to one minute and
    wanted an hour glass cursor to appear.

    The following is not however working on IE 6 or 7

    document.body.style.cursor = "wait";

    Many thanks in advance,

    Aaron
    Aaron Gray, Jan 3, 2007
    #1
    1. Advertising

  2. Aaron Gray

    VK Guest

    Aaron Gray wrote:
    > Hi,
    >
    > I am doing some JavaScript calculations that can take up to one minute and
    > wanted an hour glass cursor to appear.
    >
    > The following is not however working on IE 6 or 7
    >
    > document.body.style.cursor = "wait";
    >
    > Many thanks in advance,


    You need to give an "execution pause", otherwise any DOM/style changes
    will be applied only after you exit from the function.

    function startLongProcess() {
    document.body.style.cursor = "wait !important";
    window.setTimeout(longProcess, 10);
    }

    function longProcess() {
    // do stuff
    document.body.style.cursor = "auto";
    }

    That is "hard pause" - it works universally everywhere.

    Once I tried to use "soft pause", but I was getting mixed results -
    mostly unsatisfactory - by different UAs. You may try it first though:

    function longProcess() {
    window.setTimeout(' document.body.style.cursor = "wait !important"',
    10);
    // do stuff
    document.body.style.cursor = "auto";
    }
    VK, Jan 3, 2007
    #2
    1. Advertising

  3. Aaron Gray

    Aaron Gray Guest

    "VK" <> wrote in message
    news:...
    >
    > Aaron Gray wrote:
    >> Hi,
    >>
    >> I am doing some JavaScript calculations that can take up to one minute
    >> and
    >> wanted an hour glass cursor to appear.
    >>
    >> The following is not however working on IE 6 or 7
    >>
    >> document.body.style.cursor = "wait";
    >>
    >> Many thanks in advance,

    >
    > You need to give an "execution pause", otherwise any DOM/style changes
    > will be applied only after you exit from the function.
    >
    > function startLongProcess() {
    > document.body.style.cursor = "wait !important";
    > window.setTimeout(longProcess, 10);
    > }
    >
    > function longProcess() {
    > // do stuff
    > document.body.style.cursor = "auto";
    > }
    >
    > That is "hard pause" - it works universally everywhere.


    Okay I will try this. Thanks.

    Aaron
    Aaron Gray, Jan 4, 2007
    #3
    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?UGF1bA==?=

    Hour glass while web app is busy

    =?Utf-8?B?UGF1bA==?=, Nov 11, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    5,973
    =?Utf-8?B?UGF1bA==?=
    Nov 11, 2004
  2. Greg Smith

    Setting the cursor to the Hour Glass

    Greg Smith, Apr 12, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    334
    Mark Rae
    Apr 12, 2007
  3. Replies:
    2
    Views:
    878
    Hal Rosser
    Jun 1, 2007
  4. raj

    hour glass

    raj, Mar 10, 2008, in forum: Java
    Replies:
    3
    Views:
    401
    Roedy Green
    Mar 10, 2008
  5. dmaziuk
    Replies:
    3
    Views:
    574
    Chris Gonnerman
    Jan 25, 2011
Loading...

Share This Page