bulrush Posted August 18, 2010 Share Posted August 18, 2010 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? Quote Link to comment Share on other sites More sharing options...
swamp Posted August 18, 2010 Share Posted August 18, 2010 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/ Quote Link to comment Share on other sites More sharing options...
bulrush Posted August 18, 2010 Author Share Posted August 18, 2010 PHP is new to me and I don't know Javascript. Can you give me the JS code? Quote Link to comment Share on other sites More sharing options...
bulrush Posted August 26, 2010 Author Share Posted August 26, 2010 I don't know Jquery or Javascript. Is there a way to do it with generic Javascript? Quote Link to comment Share on other sites More sharing options...
sohaibshaheen Posted August 29, 2010 Share Posted August 29, 2010 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. Quote Link to comment Share on other sites More sharing options...
bulrush Posted September 1, 2010 Author Share Posted September 1, 2010 Thanks. And when the combo box and page is done loading, and the user can click on the combo box, how do I turn off the hourglass and change it to a regular cursor? Quote Link to comment Share on other sites More sharing options...
bulrush Posted September 20, 2010 Author Share Posted September 20, 2010 Can anyone help me out? Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.