Jump to content

Time before button becomes active


cliftonbazaar

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.

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

Archived

This topic is now archived and is closed to further replies.

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