Im using drupal. I have a field which displays a countdown timer. im trying to do something when the time is between 10 and 1 seconds left. Im quite new to php so I’m looking for a starting point.
So how do I express in php, When the timer on the form on nid is between 1 and 10 seconds do something?
Thanks for any help
Edited –
I have Ajax refreshing the page every second to update the timer etc.
How can I get something to happen at a random time between 1 and 10 seconds, does the page have to be being viewed?
The page has to be being viewed in order for anything to happen, since PHP and and Javascript are only loaded upon page view.
Furthermore, PHP cannot see or manipulate the page after the page loads initially without AJAX. You’d have to use AJAX with Javascript to access the timer and see what time it says. Then you can generate a random number between 1 and 10 and say “if(current_count == rand_time) { … do something … }”, and that would have to be in javascript.