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? Link to comment https://forums.phpfreaks.com/topic/211051-make-cursor-an-hourglass-while-php-page-loads/ 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/ Link to comment https://forums.phpfreaks.com/topic/211051-make-cursor-an-hourglass-while-php-page-loads/#findComment-1100680 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? Link to comment https://forums.phpfreaks.com/topic/211051-make-cursor-an-hourglass-while-php-page-loads/#findComment-1100687 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? Link to comment https://forums.phpfreaks.com/topic/211051-make-cursor-an-hourglass-while-php-page-loads/#findComment-1104133 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. Link to comment https://forums.phpfreaks.com/topic/211051-make-cursor-an-hourglass-while-php-page-loads/#findComment-1104789 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? Link to comment https://forums.phpfreaks.com/topic/211051-make-cursor-an-hourglass-while-php-page-loads/#findComment-1106202 Share on other sites More sharing options...
bulrush Posted September 20, 2010 Author Share Posted September 20, 2010 Can anyone help me out? Thanks. Link to comment https://forums.phpfreaks.com/topic/211051-make-cursor-an-hourglass-while-php-page-loads/#findComment-1113248 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.