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.
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.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.