I see, quite often, code like
if (tmp[i].style.display == 'none')
tmp[i].style.display = 'block';
else
if (tmp[i].style.display == 'block')
tmp[i].style.display = 'none';
or
if (tmp[i].style.display == 'none')
tmp[i].style.display = 'block';
else
tmp[i].style.display = 'none';
which is cumbersome even with the substitution T = tmp[i].style .
Consider
X = {'none':'block' , 'block':'none' /* , 'undefined' : 'none' */ }
T = F.X0 ; T.value = X[T.value]
where of course X is set once and for all. When the second line is
executed, F.X0.value is toggled. If the X-line comment symbols are
removed, false values are corrected after TWO goes.
In practice, X should be spelt blockORnone or similar.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Comment