Ranjan Datta

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromRanjan Datta
ToMe
SubjectPlus Minus in Nested Lists Collasping Script
Date14 March 2004 14:37
Hi Mark,

Value your site immensly. Its a wonderful learning guide. I was trying to
play with your collapsing nesed list script

http://www.howtocreate.co.uk/jslibs/htmlhigh/listCollapse.html

I have two questions regarding the script

1. How to make Exand All/Collapse All links
2. Is there any way that we can use + and - seperately to indicate the
state

Thank you very much for your time

Regards

Ranjan, India
FromMe
ToRanjan Datta
SubjectRe: Plus Minus in Nested Lists Collasping Script
Date14 March 2004 16:42
> Value your site immensly.

Glad you find it useful.

> I have two questions regarding the nested list script
> 1. How to make Exand All/Collapse All links

use getElementById to get a reference to the root of the list
then use rootListElement.getElementsByTagName('ul')
(or ol depending) to get all child lists
then use a 'for' loop to set each of their display styles to 'block' or
'none'

> 2. Is there any way that we can use + and - seperately to indicate the
> state

I have not provided any way to do this, as it makes the script much 
more complicated.

In the clickSmack function, every time you change a style, you need to
change the innerHTML of the relevant link to be the new character. For the
current link, you can change the innerHTML of oThisOb, but you will need
to store this in a global variable to allow you to change it back if it is
automatically collapsed later on.

This is why I stuck with the static character, but you are welcome to
modify the script as necessary.

hope at least some of this is useful.

Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.