I have a custom module whose front-end page is slow to load due to extensive database work (no forms, just a bunch of db queries to display some long tables). I want to add the little "loading" icon (similar to the iphone) while the page is loading, to show users the page is working. I've seen it on some of the Views administration pages, but I can't seem to find the code for it. Is the display code done with jQuery or a drupal module? How do I add the code to my module/page? Thanks in advance!
The loading gif is in modules/contrib/views/images/loading.gif in d7. This is a ball. The one in d6 is views/images/status-active.gif and is the clock.
Therefore, add an 'onclick' event on the link click or use onsubmit if using a form. If you are using ajax you should be able to use ajaxStart() and ajaxComplete() to show the block.
There is Page Throbber module which suits your requirement.
Page Throbber is a simple utility module which lets the site developer display a spinning "throbber" and a custom message to display when loading up pages which they know will be slow to load.