    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: Implementing drop-down menus in pure CSS (no JavaScript)</title>
        <link>https://members.accu.org/index.php/articles/1399</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>




<div class="xar-mod-head"><span class="xar-mod-title">Programming Topics + Internet Topics + Overload Journal #73 - Jun 2006</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c65/">Programming</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c69/">Internet</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c78/">Overload</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c139/">73</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/c65-69-139/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/articles/c65+69+139/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;Implementing drop-down menus in pure CSS (no JavaScript)</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 01 June 2006 11:56:00 +01:00 or Thu, 01 June 2006 11:56:00 +01:00</p>
<p><strong>Summary:</strong>&nbsp;Implementing drop-down menus to aid website navigation is usually thought to require lots of JavaScript. This article shows how to do it using just CSS.</p>
<p><strong>Body:</strong>&nbsp;<p>
A client of mine wanted his website to have drop-down menus, so I had a look round at the best way of doing this. I imagined that it would require JavaScript, but it turns out that it is possible in pure CSS, at least for fully compliant browsers. This article attempts to explain how the CSS works, and builds up the menu step by step.
</p>
<h2>
Why CSS?
</h2>
<p>
Why CSS, and not JavaScript? JavaScript is often disabled by users, as a security measure, and the necessary code for drop-down menus can be quite involved. Also, a pure JavaScript menu is not available for browsers that don't support it, such as text-only browsers. CSS-based menus are always available, even with JavaScript disabled - browsers that don't handle it will just render a list. With this technique, adding a menu to a page is as easy as creating an unordered list of links, with nested lists for the sub-menus, and including the appropriate style-sheet.
</p>
<h2>
Other CSS-based menus - what's new here?
</h2>
<p>
Tarquin's tutorial on CSS menus shows how to do menus, where the main menu is stacked vertically, and the sub-menus open out to the side, and links to CrazyTB's CSS menu page, which shows a horizontal top-level menu, with drop-downs, but which doesn't work with IE, and imposes a fixed width on the menu entries. This article describes a technique for doing drop-down menus in CSS, with a horizontal top-level menu, and variable-width menu entries - in other words, I've managed to overcome many of the limitations of the implementations I've seen.
</p>
<h2>
Menu structure
</h2>
<p>
The menus are just represented by nested <tt>UL</tt> lists. Each <tt>LI</tt> is a menu entry, and nested lists result in sub-menus. The top level <tt>UL</tt> must have the class attribute of <tt>navmenu</tt>, and everything follows from there. The menu items are just normal <tt>A</tt> links, or <tt>SPAN</tt>s where they are not links. For this example, I'm going to use the menu in Listing 1.
</p>

<table class="sidebartable"><tr><td><pre class="programlisting">
&lt;ul class=&quot;navmenu&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;/tl1&quot;&gt;Top Level Link&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/tl2&quot;&gt;SubMenus&lt;/a&gt;&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/tl2/item1&quot;&gt;Item 1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/tl2/item2&quot;&gt;Item 2&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/tl2/item3&quot;&gt;with submenus&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;/tl2/item3/one&quot;&gt;One&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;/tl2/item3/two&quot;&gt;Two&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;/tl2/item3/three&quot;&gt;Three&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/tl2/item4&quot;&gt;Item 4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;/tl3&quot;&gt;3rd entry&lt;/a&gt;&lt;ul&gt;
      &lt;li&gt;&lt;span&gt;Submenu no link&lt;/span&gt;&lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;/tl3/item1/one&quot;&gt;One&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;/tl3/item1/two&quot;&gt;Two&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/tl3/item1/three&quot;&gt;Three&lt;/a&gt;&lt;/li&gt;
           &lt;/ul&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href=&quot;/tl3/item2&quot;&gt;Item 2&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;/tl4&quot;&gt;Fourth&lt;/a&gt;&lt;ul&gt;
     &lt;li&gt;&lt;a href=&quot;/tl4/item1&quot;&gt;has items&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/tl4/i2&quot;&gt;but no submenus&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href=&quot;/tl5&quot;&gt;top level 5&lt;/a&gt;&lt;ul&gt;
        &lt;li&gt;&lt;a href=&quot;/tl5/i1&quot;&gt;item 1&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;/tl5/i2&quot;&gt;item 2&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;/tl6&quot;&gt;entry 6&lt;/a&gt;&lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;/tl6/i1&quot;&gt;foo&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;/tl6/i2&quot;&gt;bar&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;/tl7&quot;&gt;Final entry&lt;/a&gt;&lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;/tl7/i1&quot;&gt;aaa&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;/tl7/i2&quot;&gt;bbb&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;/tl7/i3&quot;&gt;ccc&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;&lt;/li&gt;
    &lt;/ul&gt;
</pre>
</td></tr><tr><td class="title">Listing 1</td></tr></table>

<h2>
A menu bar should be horizontal
</h2>
<p>
The first step is to take off all the normal list adornments, so we know what the indents are, and don't get bullet marks:
</p>
<div><pre class="programlisting">
.navmenu,
.navmenu ul,
.navmenu li
{
    padding: 0px;
    margin: 0px;
}
.navmenu li
{
    list-style-type: none;
}
</pre></div>
<p>
We make the top level menu horizontal by floating the menu items, but if we do that then the rest of the page now displays underneath them, so we need to follow the menu with a <tt>clear</tt> style. In compliant browsers, we can do this using the <tt>.navmenu + *</tt> selector, but IE doesn't support this, so we need a tag with a class attribute of <tt>.endmenu</tt> following our menu (an empty <tt>DIV</tt> is good for that):
</p>
<div><pre class="programlisting">
.navmenu li
{
  float: left;
}
.navmenu + *
{
  clear: left;
}
.endmenu
{
  clear: left;
}
</pre></div>

<table class="sidebartable"><tr><td class="title">
Float and clear
</td></tr><tr><td>
<p>
In normal usage, the <tt>float</tt> property of the CSS removes an element from the normal flow of the document, and &quot;floats&quot; it over to either the left or right edge. Such &quot;floating&quot; elements stack sideways, so if two elements both have a <tt>float: left</tt> style, then the second one will be to the right of the first. Subsequent content is flowed to the side of the floating elements.
</p>
<p>
Here, we are using <tt>float</tt> to make the <tt>LI</tt> elements stack sideways, rather than their default of stacking vertically, in order to get a horizontal menu.
</p>
<p>
The <tt>clear</tt> property is used with <tt>float</tt>, to ensure that following content appears below any floating elements. The value can be <tt>left</tt> or <tt>right</tt>, to indicate that this element (and any following ones) should be below all prior floating elements on the specified side, or both, to indicate that it should be below floating elements from either side.
</p>
<p>
Here, <tt>clear</tt> is used to ensure that subsequent content comes below the menu bar.
</p>
</td></tr></table>

<h2>
Sub-menus only display on demand
</h2>
<p>
Next off is to hide the sub-menus, and show them when the mouse moves over the parent. This requires a browser that supports :hover for <tt>LI</tt> tags. For IE, we can then simulate this with DHTML Behaviours, as suggested by Tarquin:
</p>
<div><pre class="programlisting">
.navmenu ul
{
  display: none;
}
.navmenu li:hover &gt; ul
{
  display: block;
}
.navmenu ul.parent_hover
{
  display: block;
}
</pre></div>
<p>
To add the DHTML Behaviours for IE, we can add the following to the HTML:
</p>
<div><pre class="programlisting">
&lt;!--[if gte IE 5]&gt;&lt;![if lt IE 7]&gt;
&lt;style type=&quot;text/css&quot;&gt;
.navmenu li
{
    behavior: url( ie_menus.htc );
}
&lt;/style&gt;
&lt;![endif]&gt;&lt;![endif]--&gt;
</pre></div>
<p>
The DHTML behaviour file (ie_menus.htc) is then quite straightforward - we simply set the <tt>hover</tt> class on the current element, and <tt>parent_hover</tt> on all the child elements when the mouse moves over the appropriate element, and then remove these classes when the mouse moves off again:
</p>
<div><pre class="programlisting">
&lt;attach event=&quot;onmouseover&quot; handler=&quot;mouseover&quot; /&gt;
&lt;attach event=&quot;onmouseout&quot; handler=&quot;mouseout&quot; /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function mouseover()
{
  element.className += ' hover';
  for( var x = 0; x!=element.childNodes.length; ++x )
  {
    if(element.childNodes[x].nodeType==1)
    {
      element.childNodes[x].className
         += ' parent_hover';
    }
  }
}
function mouseout()
{
  element.className =
     element.className.replace(/ ?hover$/,'');
  for( var x = 0; x!=element.childNodes.length; ++x )
  {
    if(element.childNodes[x].nodeType==1)
    {
      element.childNodes[x].className =
         element.childNodes[x].className.replace(
         / ?parent_hover$/,'');
    }
  }
}
&lt;/script&gt;
</pre></div>
<h2>
Sub-menu layout should be nice and clean
</h2>
<p>
This works OK, but as the menus expand, the content of the rest of the page gets shunted down to make room. Ideally, we'd like the menus to show on top of the rest of the page. We can do this by giving the sub-menus a position style of <tt>absolute</tt>, but if we do just that then they're hard to see over the top of the text below, and the menus don't work quite right in IE. Therefore, we will add a border, and background. Of course, if we set a background colour, we ought to set the foreground colour too. Links have a different default colour to other text, so we need to set that separately. We therefore need to add the following styles:
</p>
<div><pre class="programlisting">
.navmenu ul
{
  position: absolute;
}
.navmenu li
{
  border: 1px solid #3366cc;
  color: #000033;
  background-color: #6699FF;
}
.navmenu a
{
  color: #000033;
}
</pre></div>
<p>
In Mozilla, the drop-down menus are also horizontal, whereas in IE, they're vertical. We can fix that by making only the top-level menu entries <tt>float</tt>, rather than all of them:
</p>
<div><pre class="programlisting">
.navmenu &gt; li
{
  float: left;
}
</pre></div>
<p>
However, this doesn't work in IE - to get a nice horizontal top-level menu, we need to <tt>float</tt> the menu entries, and specify a fixed width for them, so we need to update our IE-specific block to do this:
</p>
<div><pre class="programlisting">
&lt;!--[if gte IE 5]&gt;&lt;![if lt IE 7]&gt;
&lt;style type=&quot;text/css&quot;&gt;
.navmenu li
{
    float: left;
    width: 8em;
}
&lt;/style&gt;
&lt;![endif]&gt;&lt;![endif]--&gt;
</pre></div>
<p>
Of course, you can vary the width as required.
</p>
<h2>
Links should occupy the full box
</h2>
<p>
I like the links to take up the full width of the box, so you don't have to click on the text. It's therefore nice to highlight the entire box when you hover the mouse, so you can see you're over a menu item that's actually a link.
</p>
<p>
In this case, because it's links we're referring to, IE is quite happy with :hover, so we can use the same styling for all browsers:
</p>
<div><pre class="programlisting">
.navmenu a
{
  display:block;
  width: 100%;
  text-decoration: none;
}
.navmenu a:hover
{
    background-color: #f8f8fb;
}
</pre></div>
<h2>
Sub-sub menus should pop out to the side
</h2>
<p>
We now have a new problem - if one of the drop-down menus has a sub-menu, then we can't get to the following menu items, as the sub-menu comes down on top of them. We therefore need to adjust the positioning of the sub-menu; we'll move it almost to the right-hand edge of the parent menu item. It is important that we don't move it completely off, as then users would have to move the mouse cursor off the parent to go to the sub menu, and so the menu would close. We accomplish this with the <tt>left</tt> style. If we just use that, then the menus also start a line down, so we should use <tt>top</tt> to ensure they start level. Finally, we need to make the <tt>LI</tt> elements have <tt>relative</tt> positioning, since we made the sub-menus have <tt>absolute</tt> positioning above. This resets the base position for each sub-menu as relative to its parent menu item, rather than relative to the whole page.
</p>
<div><pre class="programlisting">
.navmenu li
{
  position: relative;
}
.navmenu ul ul
{
  top: 0;
  left: 99%;
}
</pre></div>
<p>
The problem now is that the drop-down menus display underneath existing menus.
</p>
<p>
We could fix this with <tt>z-index</tt>, but IE doesn't handle that. Instead, and here's the fun bit, if we set <tt>padding-left </tt>to <tt>1px</tt>, then the menu items are shown on top, but the top specified above doesn't work - it aligns the sub-menu with the top of the parent sub-menu.
</p>
<p>
Instead, we can use <tt>margin-top</tt> with a negative offset, to shift the block up. I've chosen <tt>-1.2em</tt> as the offset, since this is the default line-height, so the menu should pop out level with the parent entry.
</p>
<div><pre class="programlisting">
.navmenu li
{
  padding-left: 1px;
}
.navmenu ul ul
{
  /* top: 0; --- remove this*/
  margin-top: -1.2em;
  left: 99%;
}
</pre></div>
<p>
This <tt>left</tt> padding shifts the drop-down menus right a fraction. Combined with the border, this makes the top-level sub-menus appear 2 pixels to the right of their parent, which is a bit untidy. The fix for this issue is to add a negative margin to the sub menus, which has the effect of shifting them back left, to compensate:
</p>
<div><pre class="programlisting">
.navmenu ul
{
  margin-left: -2px;
}
</pre></div>
<p>
Menu items that have sub-menus, but are not themselves links, still don't work quite right, since the text does not form a block for CSS layout purposes, and the sub-menu therefore is displayed too high up. This is why we put the non-link menu items in <tt>SPAN</tt> tags - the fix for this is to make these <tt>SPAN</tt> tags into block elements:
</p>
<div><pre class="programlisting">
.navmenu span
{
  display: block;
}
</pre></div>
<h2>
Exposed background
</h2>
<p>
If the top-level menu doesn't cover the full width of the browser window, then the background for the <tt>BODY</tt> element will show through in the exposed parts. To deal with this, we can set the width of the outer <tt>UL</tt> element to <tt>100%</tt>, and give it a background:
</p>
<div><pre class="programlisting">
.navmenu
{
    width: 100%;
    background-color: #6699FF;
}
</pre></div>
<p>
This works nicely in Opera and IE, but not in Firefox, which makes a change. If we also make it <tt>float</tt> to the left, then it works in all three browsers.
</p>
<div><pre class="programlisting">
.navmenu
{
  float: left;
}
</pre></div>
<h2>
Spacing around text
</h2>
<p>
Having the menu entries just display as minimal-sized blocks can mean that the text is quite close to the edges, and looks a bit crammed in. We can alleviate this by adding some padding to the <tt>LI</tt> elements:
</p>
<div><pre class="programlisting">
.navmenu li
{
    padding: 2px;
}
</pre></div>
<p>
Of course, this means that the previous <tt>padding-left</tt> entry should be removed, and the negative <tt>margin-left</tt> entry for the sub-menus needs adjusting. We also now need a <tt>margin-top</tt> entry for the first layer of sub-menus, to align the top of the sub-menu with the bottom of the parent item:
</p>
<div><pre class="programlisting">
.navmenu li
{
  /* padding-left: 1px; --- remove this */
}
.navmenu ul
{
  margin-left: -3px; /* was -2px */
  margin-top: 2px;
}
</pre></div>
<p>
Another consequence of this padding is that the highlighted links now have an extra border around them, as only the link text area highlights, not the whole <tt>LI</tt>. We can fix that by changing the background colour for <tt>LI</tt> elements that we're hovering over as well. This has the side effect that the menu entries leading to the currently displayed sub-menu are also highlighted, which works as quite a nice visual aid. We'll leave the highlighting in place for hovered links, too, so that browsers that can't handle hovering on <tt>LI</tt> elements still show some highlighting. We have to do two versions here - one for IE, and one not, as we're relying on the DHTML behaviours for the hover detection in IE.
</p>
<div><pre class="programlisting">
.navmenu li:hover
{
  background-color: #f8f8fb;
}
.navmenu li.hover
{
  background-color: #f8f8fb;
}
</pre></div>
<h2>
Browser support
</h2>
<p>
The key feature that this technique relies on is the ability to use the :hover modifier on arbitrary elements, and not just links. Older versions of browsers do not support this, but newer versions do. If this feature is not supported, just the top-level menu is shown. It is therefore important to ensure that the pages are not just accessible via the menu - I would recommend that each top-level menu entry is a link to a page with real links to the items on the appropriate sub-menu.
</p>
<p>
Internet Explorer doesn't support this usage of :hover, but it can be simulated with a small bit of JavaScript, as shown. If the user's security settings mean the JavaScript is not run, then IE will just display the top-level menu.
</p>
<p>
This technique is known to work in Opera 7.2 and 8.5, IE6 (with JavaScript), Mozilla Firefox 1.5, and Konqueror 3.4.3. It is known not to work in Opera 5, and Netscape 4.7. Of course, it doesn't work in text-only browsers such as Lynx, either - users of such browsers will see the menu just as a nested list.
</p>
<h2>
Hiding things from old browsers
</h2>
<p>
Old browsers such as Netscape Navigator 4.7 understand CSS, but get the rendering all wrong. Therefore, we need to mask our style-sheet from such browsers, so they just render the menu as a list. Of course, you could make a set of styles that worked with such browsers to make the menu render more nicely, if you wish. That's more effort than I'm willing to spend at the moment, so I'm just going to wrap the style-sheet in <tt>@media all{}</tt>, which will force such old browsers to completely ignore it.
</p>
<p>
There are numerous other techniques which can be used to adjust the style-sheet for specific older browsers, but they're beyond the scope of this article.
</p>
<h2>
Conclusion
</h2>
<p>
So, there you have it, drop-down menus in pure CSS, with a tiny bit of JavaScript for Internet Explorer. Supported in a wide range of browsers, with graceful degradation where it is not supported, this technique allows you to add menus to your website, without delving into JavaScript.
</p>
<h2>
Final style-sheet
</h2>
<p>
The final style sheet is shown on the next page, as Listing 2. The IE-specific styling, which needs to go directly into the <tt>HEAD</tt> part of the HTML,  is shown in Listing 3. The IE-specific DHTML behaviour code from ie_menus.htc is in Listing 4.
</p>
<table class="sidebartable"><tr><td><pre class="programlisting">
 @media all{
.navmenu,
.navmenu ul,
.navmenu li
{
  padding: 0px;
  margin: 0px;
}
.navmenu &gt; li
{
  float: left;
}
.navmenu li
{
  list-style-type: none;
  border: 1px solid #3366cc;
  color: #000000;
  background-color: #6699FF;
  padding: 2px;
}
.navmenu ul
{
  display: none;
  position: absolute;
  margin-left: -3px;
  margin-top: 2px;
}
.navmenu li:hover &gt; ul
{
  display: block;
}
.navmenu ul.parent_hover
{
  display: block;
}
.navmenu a
{
  display: block;
  width: 100%;
  text-decoration: none;
}
.navmenu li:hover
{
  background-color: #f8f8fb;
}
.navmenu li.hover,
.navmenu a:hover
{
  background-color: #f8f8fb;
}
.navmenu ul ul
{
  margin-top: -1.2em;
  left: 99%;
}
.navmenu span
{
  display: block;
}
.navmenu
{
  float: left;
  width: 100%;
  background-color: #6699FF;
}
.endmenu
{
  clear: left;
}
}
</pre></td></tr><tr><td class="title">Listing 2</td></tr></table><br/>


<table class="sidebartable"><tr><td><pre class="programlisting">
&lt;!--[if gte IE 5]&gt;&lt;![if lt IE 7]&gt;
&lt;style type=&quot;text/css&quot;&gt;
.navmenu li
{
  float: left;
  width: 8em;
   behavior: url( ie_menus.htc );
}
&lt;/style&gt;
&lt;![endif]&gt;&lt;![endif]--&gt;
</pre></td></tr><tr><td class="title">Listing 3</td></tr></table><br/>


<table class="sidebartable"><tr><td><pre class="programlisting">
&lt;attach event=&quot;onmouseover&quot; handler=&quot;mouseover&quot; /&gt;
&lt;attach event=&quot;onmouseout&quot; handler=&quot;mouseout&quot; /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function mouseover()
{
  element.className += ' hover';
  for( var x = 0; x!=element.childNodes.length; ++x )
  {
    if(element.childNodes[x].nodeType==1)
    {
      element.childNodes[x].className +=
         ' parent_hover';
    }
  }
}
function mouseout()
{
  element.className =
     element.className.replace(/ ?hover$/,'');
  for( var x = 0; x!=element.childNodes.length; ++x )
  {
    if(element.childNodes[x].nodeType==1)
    {
      element.childNodes[x].className =
         element.childNodes[x].className.replace(
         / ?parent_hover$/,'');
    }
  }
}
</pre></td></tr><tr><td class="title">Listing 4</td></tr></table>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
