JavaScript Throbber

Alex Bosworth has written the simplest of throbbers:
document.showThrobber = function() { if ($('throbber')) { $('throbber').innerHTML = '<span id="ajaxThrobber"><img ' + 'src="http://sandbox.sourcelabs.com/staticimages/indicator.black.gif" mce_src="http://sandbox.sourcelabs.com/staticimages/indicator.black.gif"/>' + '</span><iframe style="display:none;" xsrc="/mfm/?throb=throb" mce_src="/mfm/?throb=throb"></iframe>'; } }; document.hideThrobber = function(){ if ($('throbber')) { $('throbber').innerHTML = ''; } };
CSS
#ajaxThrobber { position:fixed; _position:absolute; /* ie hack */ right:10px; top:10px; background:#111; color:white; font-size:9pt; padding:5px; display:block; }
PHP
if (isset($_GET['throb'])) { for ($i = 0; $i <120; $i++) { if (!connection_aborted()) sleep(1); } die(); }

JavaScript Throbber

Alex Bosworth has written the simplest of throbbers:

document.showThrobber = function()
{
    if ($('throbber'))
    {
        $('throbber').innerHTML = '<span id="ajaxThrobber"><img ' +
                                    'src="http://sandbox.sourcelabs.com/staticimages/indicator.black.gif"/>' +
                                  '</span><iframe style="display:none;" src="/mfm/?throb=throb"></iframe>';
    }
};
       
document.hideThrobber = function()

{
    if ($('throbber'))
    {
        $('throbber').innerHTML = '';
    }

};
 

CSS

#ajaxThrobber
{

  position:fixed;
  _position:absolute; /* ie hack */
  right:10px;
  top:10px;
  background:#111;
  color:white;
  font-size:9pt;
  padding:5px;
  display:block;
}
 

PHP

if (isset($_GET['throb'])) {
   for ($i = 0; $i <120; $i++)  {
       if (!connection_aborted())
           sleep(1);
   }
   die();
}
 

September 6th, 2006

Tagged View

Tags Similar

Posts Fresh +

Categories View

Archives View