PDA

View Full Version : problem with a show/hide toggle thing (JS)


belledumonde
08-27-2006, 02:31 AM
original script (http://www.tjkdesign.com/articles/toggle_elements.asp) // modified script (http://hribar.info/en/archive/78/entrie.html) // modified script in action (http://hribar.info/static/projects/tjk_toggle/default.html)

problem ==> loses this important feature:
It degrades nicely (hidden elements are visible in script-disabled UAs).

if you view the modified script with JS disabled, it just comes out as a list with no way to view the <dd> contents. the original one however comes out best with all <dd>'s displayed, <dt>'s are not links, and there are no open all/close all links.

i took a look at the script which was pretty useless coz i have no idea what im looking at, so i'd really appreciate any help on this one.

and also it would really really great if someone could help and have an open all/close all for each <dl>, coz so far when i try to use the script, i can only have one pair of open all/close all links and they open/close everything instead of that one particular list under one heading.

thanks in advance!! :)

Kravvitz
09-01-2006, 08:05 PM
Hide the <dd>s via a window.onload event handler by using document.getElementsByTagName('dd').

For the open all/close all, you could pass the ID of the list you want to affect to the function that performs the action.