Swapping frames causes zero widths in Firefox/not working in NN
Hi,
I have an application that has 2 navigation menus that can be shown or hidden when buttons are clicked. Each menu is in a separate frame in a frameset document. If one menu is shown and the other hidden, then I need to put the hidden one into the leftmost column of the frameset (which requires changing frame order) and set its width to 0 using the cols attribute of the frameset.
In order to determine which ones are shown or hidden, I need to get the widths of each frame. To swap frames, I use insertBefore() on the frameset object. When I do insertBefore() in Firefox, the frames get swapped, but the page flashes innerWidth attribute no longer gives the correct value for the frames. In Netscape the insertBefore() does not swap the frames at all. I can only get it to work in IE.
I have made a few web pages that show this error. In the attachment, you should notice that the innerWidth of both frames becomes 0 after hitting the 'Swap Frames' button twice.
I have attached the sample HTML files here. Main.html is the frameset document. Please tell me if you know how to make it work for Firefox 1.5.0.7/Netscape 8.1.
Thanks in advance
# 1 Re: Swapping frames causes zero widths in Firefox/not working in NN
The function insertBefore() is part of working with nodes. Nodes are only compatible with Internet Explorer. That is why you are having troubles.
What is your purpose in swapping frames? Maybe we can work around it another way.
# 2 Re: Swapping frames causes zero widths in Firefox/not working in NN
I think your best bet would be to leave the 'width' property alone, as a width of 0 will not render correctly in some browsers. I would put them both in the same frame, or div or however you decide to do it and change the .style.display property. If style.display = 'none', the element is hidden and when style.display = 'block', the element is visible. Then write a javascript function to handle swapping the two.
Also, peejavery, maybe I misunderstood what you were trying to say, but Internet Explorer is most definitely *not* the only browser that allows you to use the Document Object Model. It should be possible to use the document.getElementById('id').style.display to change these for you.
Good luck!
# 3 Re: Swapping frames causes zero widths in Firefox/not working in NN
Interesting, this thread is a month old and no reply from the original poster.
Also, peejavery, maybe I misunderstood what you were trying to say...Document Object Model.
No. I said nothing about DOM compatibility. I said nodes. You misunderstood me.
Now, I did mis-state something. I did not mean that all functions of nodes were IE only, but that some are.