Jump to content

Make cursor an hourglass while php page loads


bulrush

Recommended Posts

PHP 2.11.10

 

I have a php page that loads. It takes about 4-5 seconds because I am constructing a select/combo box with 2400 records. While the whole page is loading I would like to make the cursor an hourglass while the cursor is over the PHP page, so the user cannot click on anything until the page is done loading.

 

During production I expect 10,000 records in this combo box so disabling user input while the page is loading becomes more important.

 

How do I do that?

 

You'd need to do it in JavaScript - I'd recommend loading in the contents with AJAX.

 

If you were using the jquery library you could do something like

 

//set cursor as wait with css

$('body').css('cursor', 'wait');

 

//load results into div

$('#info').load('results.php', function(){

//load has completed

$('body').css('cursor', 'auto');

});

 

More info: http://api.jquery.com/load/ + http://api.jquery.com/css/

  • 2 weeks later...

This is pretty Simple:

 

change your css file to ...

 

body{

cursor: wait;

}

 

and then use this fucntion in head

<script type="text/javascript">

window.onload=function(){
document.body.style.cursor='auto';
}


</script>

Hope this answers the question.

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.