[Javascript] [Beginner] What is going on with my show/hide function?

Matt Warden mwarden at gmail.com
Mon Nov 13 12:51:20 CST 2006


On 11/13/06, Roger Roelofs <rer at datacompusa.com> wrote:

> Save yourself some debugging grief by changing the javascript to
> manipulate the className attribute instead.
>
> See <http://onlinetools.org/articles/unobtrusivejavascript/
> cssjsseparation.html> for an explanation of the whys and hows of this
> technique.

I'll second this. You really should be manipulating group membership
which indirectly manipulates style, not directly manipulating style
with JS. Granted, 'hidden' and 'shown' aren't exactly the best groups,
but it's better than using the style object. Either user Christian's
jscss function or something similar. If you're using YUI, you can use
Dom.*class() functions:

http://developer.yahoo.com/yui/dom/#class

-- 
Matt Warden
Cleveland, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the Javascript mailing list