[thelist] DHTML Test and Critique

Tony Grimes info at scribenewmedia.com
Thu Mar 17 14:26:22 CST 2005


I was wondering if anyone could test and critique a collapsible-menu script
I wrote for a client's site map:

http://www.tonygrimes.com/collapsible_menu.html

It's inspired by Dave Lindquist's menus:

http://www.gazingus.org/html/menuExpandable.html

Hopefully, it degrades gracefully. I've only tested Safari/Mac,
Firefox1/Netscape7/Mac IE5/Mac and IE6/PC.

I'm not really familiar with Javascript and browser compatibility issues (I
come from a PHP background) so I'm open to suggestions on how to improve it.
I'd especially like to hear ideas on how to cut down code size, easier ways
to do manipulate the DOM, etc.

Some issues I've found so far:

- The "show/hide all" links don't work in Safari. Can't figure out why.

- the plus/minus list images don't initially show in Safari and Mozilla
(Mac), or they don't draw correctly. Maybe I should declare the styles
explicitly instead of changing the class name?

- My use of splice() probably excludes some modern-ish browsers (IE5/PC?).
Is there a better way of removing elements from an array.

- Not really an issue, but I chose to use firstChild instead of innerHTML
when copying the h3 content into a link. Is there a DOM-friendly way to copy
all child/grandchild nodes into a new element? If not, I think I'll go with
innerHTML eventually.

- Question: does Javascript have an inArray() method like PHP's in_array()?
I just made my own for now.

Any input would be greatly appreciated.

TIA

Tony



More information about the thelist mailing list