September 26th, 2012, 02:26 AM
Timed Text Box
I was wondering how hard it would be to create something like this:
- Large Text Box in middle of the page (20 lines)
- When you start typing it starts a timer (2mins)
- When timer gets to zero it doesn't let you type anymore
-- Extra: Maybe verify what you typed based on another file (.txt or something else) and highlights what was wrong
Any help would be awesome. Thanks.
September 27th, 2012, 07:12 AM
Simply put, I think that would require a <textarea>, and a setInterval() timer started at page loads. After 2*60*1000 msecs, the timer should add readonly attribute to that textarea.
I'm not sure about your "extra"... does this checking happen after the the textarea has been disabled or anytime before? The former is easier I guess, since you only need to load a text file (via AJAX) and perform checking; but the latter might require an keyup event handler be installed to the textarea.