Re: time to respond to a series of radio button?



In comp.lang.javascript message <dLydnUyAfIxU0e_UnZ2dnUVZ_gOdnZ2d@supern
ews.com>, Sat, 17 Jan 2009 22:25:29, Conrad Lender <crlender@xxxxxxxxx>
posted:
On 2009-01-17 21:48, Geoff Cox wrote:
[...] could you please explain what the following lien is doing?

if (/(^|\s)timer(\s|$)/.test(tgt.className)) {

It uses a regular expression to test if "timer" is one of the class
names in tgt.className. (^|\s) means "start of string of white space",
and (\s|$) means "white space or end of string".

How about /\btimer\b/ for the RegExp?


In comp.lang.javascript message <s8ednb7qCLJV0O_UnZ2dnUVZ_q3inZ2d@supern
ews.com>, Sat, 17 Jan 2009 22:29:43, Conrad Lender <crlender@xxxxxxxxx>
posted:
On 2009-01-16 20:04, Dr J R Stockton wrote:
var When = Infinity / or 1E99 to save four characters

Give the selecting buttons an onClick that includes
D = +new Date() ; if (D < When) When = D
so only the first one can change When.

Why bother with Infinity (or any other value)?

var when;
// ...
when = when || +new Date();

Clarity.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 7.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
I find MiniTrue useful for viewing/searching/altering files, at a DOS prompt;
free, DOS/Win/UNIX, <URL:http://www.idiotsdelight.net/minitrue/> unsupported.
.