I don't have a solution for the problem at hand but I would like to suggest an alternate course of development.

When JavaScript is used to manipulate the DOM tree or add behaviours to a webpage it is almost always better to use a cross-browser library then to code it by hand.
The problems you are encountering between IE and Firefox are only amplified when a broader selection of browser and browser versions are taken into consideration.
Relying on a third party to do browser compatiblity and performance optomiztions frees up your time as a developer to focus on implementing the desired behaviour.
There are many options out there -- Prototype, Dojo, MooTools, etc. -- but jQuery is my library of choice.

I took the liberty of rewriting the webpage in question to create the behaviour you desired with a few lines of jQuery.
I commented the code thoroughly so you or anyone else new to jQuery should be able to follow what's going on and why.

For further reading on the nature and use of jQuery see:

best of luck,
Dan Brubaker Horst
Project / Application Developer - Hesburgh Library of Notre Dame
From: Code for Libraries [[log in to unmask]] On Behalf Of Laura Harris [[log in to unmask]]
Sent: Tuesday, November 03, 2009 1:37 PM
To: [log in to unmask]
Subject: [CODE4LIB] Javascript question - works in FF, but not in IE

Hello, new subscriber here...I'm trying to fix some javascript. It works as expected in Firefox, but not in Internet Explorer. FWIW, am using FF 3.0.14 and IE 7.0.6.

The code is up on pastebin here:

I'm aware that setAttribute & getAttribute are buggy in Internet Explorer, so (in an alternate version of the code) I replaced the toggle bit in function createToggleFunction with the following:

if (toggleElement.className == 'collapsibleClosed') {
                toggleElement.className = 'collapsibleOpen';
                toggleElement.src = OPEN_IMAGE;
        } else {
                toggleElement.className = 'collapsibleClosed';
                                toggleElement.src = CLOSED_IMAGE;

However, I must assume I did something wrong in the code above, because it doesn't work in Firefox.

Any thoughts? Let me know if I need to provide more information.


Laura Harris
Web Services Librarian
Grand Valley State University
Allendale, MI 49401