Apr
01
2008

Javascript Expand/Collapse Element

Note: This piece of code wasn't entirely created by me. Also, I don't claim to be knowledgeable in javascript...I'm just sharing.

function expandCollapse() {
for (var i=0; i<expandCollapse. »
arguments.length; i++) {
var element = document.getElementById »
(expandCollapse.arguments[i]);
element.style.display = (element.style. »
display == "none") ? "block" : "none";
	}
}

Which will allow you to expand and collapse a div in css. I needed this for a new addition to VisitMatewan.com that I'm working on. Handy....

Written by Kevin in: Javascript, WebDev |

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes