flappy_warbucks Posted March 21, 2007 Share Posted March 21, 2007 Hi! Now i am normally a PHP man myself, and only really use Javascript when i really need to, but i have a problem that only Javascript can solve basically what i am looking for is a way to do time based events in javascript. what i need to do is stop a button from being pressed for about a minute from the time the page is loaded. So basically the scenario i am looking for is this: one of my users log into the system and they are given details of what they have to do, i know that for a fact this activity cannot be done in less then 1 minute so to stop the user just clicking willy nilly (that's randomly for the who's at home) i only want the button to become active after about a minute from the time the page loads, to stop the users getting better jobs etc. i have tried googling to no avail :'( so now i am calling out to you guys any and all help gratefully received and appreciated. Anty! Quote Link to comment Share on other sites More sharing options...
mainewoods Posted March 21, 2007 Share Posted March 21, 2007 Hope you're not being obnoxious to your users cause you will lose them if you do but here goes: In the head section of your doc put: <script type="text/javascript"> var allowlinks = false; //no links allowed var t=setTimeout("allowlinks = true", 60000); //links will be allowed! </script> http://www.w3schools.com/js/js_timing.asp code each link like this: <a href="the url" onclick="if (allowlinks) return true; else return false;">Go here</a> or submit button: <input type="submit" value="submit" onclick="if (allowlinks) return true; else return false;"> Quote Link to comment Share on other sites More sharing options...
flappy_warbucks Posted March 21, 2007 Author Share Posted March 21, 2007 Hope you're not being obnoxious to your users cause you will lose them if you do but here goes: In the head section of your doc put: <script type="text/javascript"> var allowlinks = false; //no links allowed var t=setTimeout("allowlinks = true", 60000); //links will be allowed! </script> http://www.w3schools.com/js/js_timing.asp code each link like this: <a href="the url" onclick="if (allowlinks) return true; else return false;">Go here</a> or submit button: <input type="submit" value="submit" onclick="if (allowlinks) return true; else return false;"> haha na there is a good reason why i am doing this and belive it or not its being done so its more fair on the other sales people. Anyways Thank you 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.