Jump to content

Time before button becomes active


Recommended Posts

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

Link to comment
Share on other sites

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

 

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.