Without going into too much detail, here is how you build a DHTML tree (my
version anyway):

1) use <div> tags with classes
2) for sub-elements in the tree, put them all in a separate <div> wrapper
with a left margin of (say) 15px
3) when you click on the parent of a subtree, it closes/opens the tree
(toggle() function) depending on whether it is open or closed.
4) opening and closing the tree is a case of (in Javascript) changing the
<div> style.display='none' and style.display='block' (or inline depending on
how you've done it)

That's it!

Paul

PS Quick example (not necessarily the best way of doing it, but it appears
to be cross-browser so...):

<script language="Javascript">  
function toggle(folderID) {
        if(document.getElementById(folderID).style.display=='block') {
                document.getElementById(folderID).style.display='none';
        }
        else {
                document.getElementById(folderID).style.display='block';
        }
}
</script>

<div>
        <div onclick="toggle('wrapper_root');" style="background-color:
#abcdef;">root element</div>
        <div id="wrapper_root" style="padding: 0px 0px 0px 15px; display:
none;">
                <div onClick="toggle('wrapper_sub1');"
style="background-color: #abcdef;">sub element1</div>
                <div id="wrapper_sub1" style="padding: 0px 0px 0px 15px;
display: none;">
                        <div>sub element11</div>
                        <div>sub element12</div>
                        <div>sub element13</div>
                        <div>sub element14</div>
                </div>
                <div>sub element2</div>
                <div>sub element3</div>
        </div>
</div>
> -----Original Message-----
> From: Dave Phipps [mailto:[EMAIL PROTECTED] 
> Sent: 14 October 2003 08:58
> To: [EMAIL PROTECTED]
> Subject: RE: [ cf-dev ] Tree viewer
> 
> 
> Would you care to share your dhtml tree viewer?  I have looked at the 
> deeptree which is based upon the MSDN xml tree but there is 
> only an asp 
> example and it may as well be written in Greek!
> 
> Cheers
> 
> Dave
> 
> At 10/13/2003 19:46, you wrote:
> >How about a DHTML version. I have written one that I use for 
> my content 
> >management system, managing nested categories and the likes.
> >
> >Russ Michaels
> >Macromedia/Allaire Certified ColdFusion Developer
> >
> >CFDeveloper
> >The free resource and community for ColdFusion developer. 
> >http://www.cfdeveloper.co.uk
> >
> >Join the CFDeveloper discussion lists.
> >To subscribe send an e-mail to [EMAIL PROTECTED]
> >
> >
> > > -----Original Message-----
> > > From: Paul Johnston [mailto:[EMAIL PROTECTED]
> > > Sent: 13 October 2003 11:23
> > > To: [EMAIL PROTECTED]
> > > Subject: [ cf-dev ] Tree viewer
> > >
> > >
> > > I am after a tree viewer like the Windows Help tree viewer (ie 
> > > folders and
> > > documents)
> > >
> > > Any ideas?  Anyone know the object that is used and can 
> it be used 
> > > in a webpage?
> > >
> > > Paul
> > > -----------------------------------
> > > Paul Johnston
> > > PJ Net Solutions Ltd
> > > http://www.pjnetsolutions.com
> > > [EMAIL PROTECTED]
> > > +44 (0)7866 573013
> > >
> > >
> > >
> > > --
> > > ** Archive: 
> > > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > >
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED] 
> > > For human help, e-mail: [EMAIL PROTECTED]
> > >
> >
> >
> >--
> >** Archive: 
> http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> >
> 
> >To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> >For additional commands, e-mail: 
> [EMAIL PROTECTED] For 
> >human help, e-mail: [EMAIL PROTECTED]
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED] For human help, e-mail: 
> [EMAIL PROTECTED]
> 



--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to