[thelist] DHTML - div display.

Robert Gormley robert at pennyonthesidewalk.com
Sun Feb 6 20:06:32 CST 2005


Matt Warden wrote:

>// using, instead:
>// document.getElementById('contentContainer').getElementByTagName('div');
>// could save you some iterations, if appropriate
>for (var i=0; i<divs.length; i++)
>{
>      if (divs[i].className=='clientExpanded')
>divs[i].className='clientCollapsed';
>}
>this.className='clientExpanded';
>
>Make sure you are setting the onclick property appropriately if you
>are going to use 'this'. See PPK's excellent explanation here:
>
>http://www.quirksmode.org/index.html?/js/this.html
>
>This assumes that the div only can have one class name. You would need
>to use indexOf and appropriately replace/append the class name if
>there can be more than one.
>  
>
Okay, getting there, but first, an apology, and thanks - really 
appreciate this... I need to properly learn this stuff, just don't have 
the time before this deadline. :)

I had intended to just set display, mainly because there are multiple 
classes on the container, a la "expandedContainer contactDetails"...

Also, the onclick will sit on a div within the container, how would I 
reference its parent div?

Cheers,
Rob



More information about the thelist mailing list