Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 145729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:28:31+00:00 2026-05-11T08:28:31+00:00

Let’s say I have a javascript method that takes a little to long to

  • 0

Let’s say I have a javascript method that takes a little to long to finish to go without any user feedback at all. In my case it’s sorting the rows in a table element (all in the DOM; only takes too long if there are a lot of rows), but it might do anything. I want to show the "progress" cursor while it runs. Here is what I have currently, but I’ve tried several other things as well:

// SORT    document.body.style.cursor = "progress"; MyLongRunningMethod(); //blocks for 10-15 seconds before returning document.body.style.cursor = "auto";     

Unfortunately, nothing happens. MyLongRunningMethod() does it’s thing correctly, but the cursor never changes. My thought is that the browser needs to wait for the method to return to be able to handle the cursor change message generated by the windowing environment, but that may be way off and even if it’s true I don’t know how to fix it.

Any other ideas?


[edit]: I decided all the back-story I had up wasn’t really necessary. If you really want to read it check the revision history.


Final Results

I ended up using RoBorg’s solution. It doesn’t mess up the code as much as I was originally thinking, because I can keep the function declared right there- it’s just like adding an inline scope block.

Interestingly, on Firefox I discovered that this means I don’t need to change the cursor at all. I found that after I added the setTimeout call I was sometimes seeing a wait cursor show up before the progress cursor was set, so I commented out my cursor code. It turns out that something in using setTimeout to push this out of the click event handler itself allows FireFox to figure out on it’s own that the cursor should change. Unfortunately, IE is not that smart so I did put the cursor code back.

This lends credence to my belief that a cursor change is the appropriate action here — given the opportunity it’s what the browser will do anyway. I really don’t want to have to add and remove new items (like a busy image of some type) into the DOM for a page that I know very little about. The script should match no matter what visual design the page uses.

Finally, Chrome makes the whole thing irrelevant. Using the same data, Chrome does in less than 5 seconds what took IE and Firefox 10 to 15 seconds to accomplish. So their javascript engine really is faster. I can’t wait for the Firefox 3.1 engine. Unfortunately people here are still mostly using IE6.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:28:32+00:00Added an answer on May 11, 2026 at 8:28 am

    Is using a timer out of the question?

    document.body.style.cursor = 'progress';  setTimeout(function() {     SortTable(cell.cellIndex, dir, sortType);     document.body.style.cursor = 'auto'; }, 10); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 121k
  • Answers 121k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Unfortunately, if XML is malformed like that, you can't come… May 12, 2026 at 12:33 am
  • Editorial Team
    Editorial Team added an answer GNU Indent has support for breaking long lines. http://www.gnu.org/software/indent/manual/indent.html#SEC12 May 12, 2026 at 12:33 am
  • Editorial Team
    Editorial Team added an answer It's CS1591. Just press F1 on the warning location to… May 12, 2026 at 12:33 am

Related Questions

Let's say you create a wizard in an HTML form. One button goes back,
Let's say I'm building a data access layer for an application. Typically I have
Let's say you have a class called Customer, which contains the following fields: UserName
Let me try to explain what I need. I have a server that is
Let's say we have a simple function defined in a pseudo language. List<Numbers> SortNumbers(List<Numbers>

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.