Jump to content

Time based events in Javascript


flappy_warbucks

Recommended Posts

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!

Link to comment
Share on other sites

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;">

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.