Facebook Fun - Time

Hello all,

I would like to have a simple picture (I will accept a button if it's to difficult to use images) that when I click it starts a timer.  When I click stop it stops the timer and shows the time to 5 (if possible) decimal places.  I would like to do this within facebook (not in an iframe but using FBML)

1) Click "Start"
2) Time starts ticking - Visually shows counting up on screen
3) Click "Stop"
4) Display the seconds passed, to 5dp, from when the start and stop buttons were pressed

I hope this makes sense?

Any advice would be apreciated, Alan.
Who is Participating?
Ray PaseurConnect With a Mentor Commented:
Alan, I'm sure you can build this for the Facebook platform.  I'm not a user of FBML, but the PHP portion is pretty simple.

At the start, you would make an AJAX call.  The background script would set this:
$start = microtime(TRUE);

... and return a signal to display a DIV with a timer image in it.  (I would suggest an animated spinning clock or something like that).

At the stop, you would make another AJAX call.  The background script would set this:
$stop = microtime(TRUE);
$duration = number_format($duration,5);

... and return a signal to replace the DIV image with the text giving the duration.

So that is the code framework.  The central issues you may find go to the responsiveness of the internet and the app load at Facebook.  On a busy day, the latency between the client mouse-click and the backend application can be significant.

HTH, ~Ray
Ionut A. TudorPHP ProgrammerCommented:
i'm not aware of facebok system, but looks like you want a client side function but you posted in PHP Category, in this case you'll find better support in the EE JavaScript Category or try to explain better what you need to achieve in PHP ?
ammo12kmfAuthor Commented:
You are right, client side is the way forward, many thanks, Alan.
All Courses

From novice to tech pro — start learning today.