I found this little bit of code on a different site and it's perfect for what I need, ALMOST. I've been fiddling with this all day and I just can't seem to create a box that the user can enter how many minutes they want the timer to take. I can hard code the time in, but that's not what I'm looking for.
Any help?
Code:<html> <body> <div id="countdown"></div> <div id="notifier"></div> <script type="text/javascript"> function display( notifier, str ) { document.getElementById(notifier).innerHTML = str; } function toMinuteAndSecond( x ) { return Math.floor(x/60) + ":" + x%60; } function setTimer( remain, actions ) { (function countdown() { display("countdown", toMinuteAndSecond(remain)); actions[remain] && actions[remain](); (remain -= 1) >= 0 && setTimeout(arguments.callee, 1000); })(); } setTimer(60, { 10: function () { display("notifier", "Just 10 seconds to go"); }, 5: function () { display("notifier", "5 seconds left"); }, 0: function () { display("notifier", "Time is up"); } }); </script> </body> </html>



Reply With Quote

Bookmarks