cliftonbazaar Posted May 9, 2011 Share Posted May 9, 2011 Hi All, How would I go about programming a HTML button that cannot be clicked on for two seconds after it loads? As part of a game I wish to stop people simply re-clicking the button and I think a delay of about two seconds would stop abuse of this (if they click it every two seconds then that's fine). I have read the manual for sleep() but it doesn't do exactly what I want - I want the rest of the page to load (and display), and the button to be grayed out for the two seconds, and then the button to be active. James Quote Link to comment https://forums.phpfreaks.com/topic/235902-time-before-button-becomes-active/ Share on other sites More sharing options...
sunfighter Posted May 9, 2011 Share Posted May 9, 2011 Once a page loads into a browser php is a no go, because it needs the server to interpret it's code. You need javascript for this. I would have the js script make the button appear so users can't turn js off and have the button. Quote Link to comment https://forums.phpfreaks.com/topic/235902-time-before-button-becomes-active/#findComment-1212943 Share on other sites More sharing options...
Zurev Posted May 9, 2011 Share Posted May 9, 2011 Once a page loads into a browser php is a no go, because it needs the server to interpret it's code. You need javascript for this. I would have the js script make the button appear so users can't turn js off and have the button. Totally agree, use javascript to have the button appear, you can use an onclick to make the button inactive for the next 2000 milliseconds or however javascript default handles seconds. (Forgotten!) Quote Link to comment https://forums.phpfreaks.com/topic/235902-time-before-button-becomes-active/#findComment-1212946 Share on other sites More sharing options...
cliftonbazaar Posted May 9, 2011 Author Share Posted May 9, 2011 Thanks all Quote Link to comment https://forums.phpfreaks.com/topic/235902-time-before-button-becomes-active/#findComment-1213069 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.