View Full Version : Code working in FF2 but nothing else!

06-20-2008, 07:20 PM
I have some code that works fine in FF2, but for some reason it doesn't work in FF3, IE6 and Safari.

To see see the problem click on the link below then click on any marker on the map. Then click on a preview image to see a larger version. This much appears to work in all browsers, but when you close the image and open another one something goes wrong.

The image is located within a div with another div inside it. This nested div starts off with a height of 10000px to allow the image to load of screen and then be resized before the nested div is then shrunk to show the image. Line 524:

document.getElementById('imageSpacer').style.height=(((myHeight-120) - (img_height)) / 2 + 'px');

Then after this the close button fails to work altogether. In addition to this the forwards and backwards buttons (currently not styled) do not work in anything other then FF2.

I have tried trawling through my code trying to find out where it is going wrong but to no avail. I hope I have explained this clearly enough and I would be very grateful if anyone can help!


06-21-2008, 11:12 AM
My console reports that document.getElementById('pictureRight') is null - on this line: document.getElementById('pictureRight').style.display="none"; and an unterminated string literal with your javascript:loadImage()

I don't know if that helps.

06-21-2008, 06:55 PM
Your page does not pass the W3C validation either:

06-22-2008, 01:41 PM
I have now validated my XHTML and passes fine now.

I removed the offending Javascript that you mentioned above but that does not appear to be what is causing the problem. What were you using to discover that error anyway? I have tried using the error console in FF and Firebug but can't see a feature that would give me that kind of error.

06-22-2008, 05:54 PM
After I threatened my code it finally responded. Well, not quite. The problem Appears to be the drawing and re-drawing of overlaying DIVs, it just didn't like it. So each time the DIVs now have a number in their name which increments each time they are drawn again resulting in two DIVs never having the same name. Not quite strictly how it should probably work, but it does the trick none the less.