Path: csiph.com!usenet.pasdenom.info!news.chainon-marquant.org!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <3200796.aU67uLZWGn@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sat, 24 Mar 2012 10:58:30 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit Subject: Re: IE very slow when showing/hiding table row Newsgroups: comp.lang.javascript References: <6fdd22b1-7b67-4dbf-a12b-54450b1c5ec1@pz2g2000pbc.googlegroups.com> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 29 NNTP-Posting-Date: 24 Mar 2012 10:58:30 CET NNTP-Posting-Host: 182a5bc0.newsspool1.arcor-online.net X-Trace: DXC=fNAS861bF3PHigV@eW57PQic==]BZ:af^4Fo<]lROoRQ<`=YMgDjhgRn:oU1L8[`\^DZm8W4\YJN\J`:FmdeL>KP6JDa4d]ka`Uf7dSGNdYM1W X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.javascript:13035 Gregor Kofler wrote: > Am 2012-03-23 20:23, Lisa Liel meinte: >> function doShowHide(rw){ >> var o = eval("document.all." + rw); >> if (o.style.display == "none"){ >> o.style.display = ""; >> } else { >> o.style.display = "none"; >> } >> } > > Ugh! You know what is said about eval()? > > var o = document.getElementById(rw); > > will do the same in a safer and compatible way. ACK for "safer", but I am not so sure about "compatible". When in doubt, use both (with the bracket property accessor instead of eval(), of course), falling back to the former (falling back to document.layers, if need be). PointedEars -- realism: HTML 4.01 Strict evangelism: XHTML 1.0 Strict madness: XHTML 1.1 as application/xhtml+xml -- Bjoern Hoehrmann