Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18057

Re: Simple question about div show or hide

From Cezary Tomczyk <cezary.tomczyk@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Simple question about div show or hide
Date 2013-01-10 21:02 +0100
Organization Aioe.org NNTP Server
Message-ID <kcn6od$pg0$1@speranza.aioe.org> (permalink)
References <b7e6883d-fe02-41ca-b4e8-89cfaccde7f6@googlegroups.com> <kckoce$v6$2@speranza.aioe.org> <kcmrk9$kkb$1@dont-email.me>

Show all headers | View raw


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/

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Simple question about div show or hide justaguy <lichunshen84@gmail.com> - 2013-01-09 12:54 -0800
  Re: Simple question about div show or hide Scott Sauyet <scott.sauyet@gmail.com> - 2013-01-09 13:29 -0800
  Re: Simple question about div show or hide Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-01-09 22:44 +0100
    Re: Simple question about div show or hide justaguy <lichunshen84@gmail.com> - 2013-01-09 14:25 -0800
      Re: Simple question about div show or hide Richard Yates <richard@yatesguitar.com> - 2013-01-09 14:47 -0800
    Re: Simple question about div show or hide Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-01-10 09:52 -0700
      Re: Simple question about div show or hide Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-01-10 21:02 +0100
  Re: Simple question about div show or hide Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2013-01-10 18:26 +0100
    Re: Simple question about div show or hide "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-10 19:37 +0100
  Re: Simple question about div show or hide Danny <dann90038@gmail.com> - 2013-01-10 12:47 -0800

csiph-web