[thelist] Javascript function to disable certains parts of a form
.jeff
jeff at members.evolt.org
Mon Jun 24 02:40:01 CDT 2002
jon & david,
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: jon steele
>
> currE = eval("document.f."+es[i]);
> currE.disabled = true;
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
ack, just so no to the unnecessary use of the eval() method. bracket
notation is your friend and should be used whenever possible.
document.f.elements[es[i]].disabled = true;
there's absolutely no harm in nesting something that's using bracket
notation within another bracket notation. however, if that makes you
squeamish, then you could do it like this:
currentElm = es[i];
document.f.elements[currentElm].disabled = true;
the use of the power-hungry eval() method chaps my hide whenever i see it.
maybe i'll get around to writing a rant, errr, i mean an article for the
site one of these days.
good luck,
.jeff
http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/
More information about the thelist
mailing list