[thelist] Javascript function to disable certains parts of a form

jon steele jjsteele22 at yahoo.com
Mon Jun 24 10:00:01 CDT 2002


Thanks Jeff. Good point.

But is a function being "power-hungry" that much of an issue on the client-side? I haven't read up
on this so any reading material'd be appreciated.

Jon

--- ".jeff" <jeff at members.evolt.org> wrote:
> 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.

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the thelist mailing list