« Use Sticky Forms! || I’m On Tumblr »

Javascript Expand/Collapse Element

0


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....


This entry was posted on Tuesday, April 1st, 2008 at 8:48 pm and is filed under Blog, Javascript, WebDev. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Get a Trackback link

No Comments Yet

You can be the first to comment!

Leave a comment