D
Dr John Stockton
I see, quite often, code like
if (tmp.style.display == 'none')
tmp.style.display = 'block';
else
if (tmp.style.display == 'block')
tmp.style.display = 'none';
or
if (tmp.style.display == 'none')
tmp.style.display = 'block';
else
tmp.style.display = 'none';
which is cumbersome even with the substitution T = tmp.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.
if (tmp.style.display == 'none')
tmp.style.display = 'block';
else
if (tmp.style.display == 'block')
tmp.style.display = 'none';
or
if (tmp.style.display == 'none')
tmp.style.display = 'block';
else
tmp.style.display = 'none';
which is cumbersome even with the substitution T = tmp.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.