[Javascript] ISO unobtrusive JS way to change body class
Mike Dougherty
mdougherty at pbp.com
Mon Mar 27 14:59:41 CST 2006
Have you seen this:? http://www.htmldog.com/ptg/archives/000050.php
On Mon, 27 Mar 2006 14:32:35 -0600
Scott Moore <moore.scott at gmail.com> wrote:
> I'm working on a proof of concept for a navigation system and am in need of some help. At the
>moment, I've got this code:
>
> <body class="first">
> <ul id="navmenu">
> <li id="first"><a href="#" onMouseover="document.body.className='first'">First Section</a></li>
> <li id="second"><a href="#" onMouseover="document.body.className='second'">Second
>Section</a></li>
> <li id="third"><a href="#" onMouseover="document.body.className='third'">Third Section</a></li>
> </ul>
>
> The idea is when you hover over an option, the JS changes the class of the body tag and the
>associated sub-menu is displayed. However, when you roll off an option, the class of the body
>tag doesn't return to it's original setting. Now for each section, I could create a separate
>nav file and add onMouseout="document.body.className='current_section'" to each link, but
>that's too messy and I want to have only 1 nav file.
>
> So with the intention of following the idea of unobtrusive JS, I don't believe I'm heading in
>the right direction by using onMouseover. Can anyone point me in the direction I should be going
>a cleaner solution?
>
> Scott
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>
> __________________________________________________________
> This message was scanned by ATX
> 3:33:17 PM ET - 3/27/2006
More information about the Javascript
mailing list