Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!aioe.org!.POSTED!not-for-mail From: Cezary Tomczyk Newsgroups: comp.lang.javascript Subject: Re: Simple question about div show or hide Date: Thu, 10 Jan 2013 21:02:26 +0100 Organization: Aioe.org NNTP Server Lines: 27 Message-ID: References: NNTP-Posting-Host: zYd0PXwpR9QMvAmoEDGsiw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.javascript:18057 W dniu 2013-01-10 17:52, Martin Leese pisze: > Cezary Tomczyk wrote: > >> I would write in that way*: > ... >> switchView = function(e){ >> if (b) { >> elm.style.display = 'block'; >> } else { >> elm.style.display = 'none'; >> } > ... >> 3) it's better to use 'class' and switch classes instead of inline >> styles > > Why? Or, more correctly, under what > conditions is it better? 1. In above example logic ix mixed with presentation, which developer should avoid. 2. "Class"-es can contains more styles, not only "display". + http://webdesign.about.com/od/css/a/aa073106.htm -- Cezary Tomczyk http://www.ctomczyk.pl/