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

Roger Roelofs rer at datacompusa.com
Mon Nov 13 11:59:16 CST 2006


Mark,

On Nov 13, 2006, at 12:27 PM, Mark Kelly wrote:

> I have a written a simple function to toggle the visibility of a <div>
>   ---- 8< ---
> I set the initial display value explicitly by setting the div class to
> either .shown or .hidden just to set the display property.

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.

Roger
-------------------------------------------------------
Roger Roelofs                          web   www.datacompusa.com
Datacomp Appraisal Services   Email rer at datacompusa.com
3215 Eaglecrest Drive, NE
Grand Rapids, MI  49525-4593





More information about the Javascript mailing list