javascript accordion using DOM + CSS (no jQuery)

mtnhcmgrl

I'm trying to create a simple javascript accordion that will let me show/hide <p> paragraphs when I click on an <h2>. When the page is loaded, the <p> are automatically hidden. (This part works ok). When you click on the H2, I want the paragraphs to then appear. Something with the h2 onclick event or either the way I'm calling the DOM is not working. I was hoping for some help/guidance.

The "this" is the h2. It's next sibling is the p tags. You are telling it to grab all the paragraphs who's nodeType is 3 for text nodes? What I'm not sure is what the next bit of code means....
"? this.nextSibling.nextSibling : this.nextSibling;"

Fang

It's next sibling is the p tags

Only in IE.
Other browsers insert text nodes, hence this.nextSibling.nextSibling, which will get the node after the text node, the p element.