Forum Moderators: open

Message Too Old, No Replies

offsetWidth in FF

         

Joe Belmaati

5:17 pm on Jun 7, 2008 (gmt 0)

10+ Year Member



Hi,
I am trying to set width of one table = the width of another table using a small piece of js that get called in the body onload event

function setWidth()
{
var forum = document.getElementById('forum');
var shadow = document.getElementById('shadow');

shadow.style.width = forum.offsetWidth + 'px';
}

Works perfectly in IE and Safari, but not in FF. I have tried a document.write(forum.offsetWidth) which prints 1405 in FF and 1204 in IE and Safari....

Any ideas as for what I am doing wrong? Any help is appreciated! Thanks.

[edited by: Joe_Belmaati at 5:20 pm (utc) on June 7, 2008]

poppyrich

7:46 pm on Jun 10, 2008 (gmt 0)

10+ Year Member



Is it that you're getting a different offsetWidth, is that it?
Also, what version of FF are you testing on?

Joe Belmaati

8:43 pm on Jun 10, 2008 (gmt 0)

10+ Year Member



Yes, that's it. Using FF 2.0.0.14

poppyrich

2:47 pm on Jun 11, 2008 (gmt 0)

10+ Year Member



Sounds like FF is simply rendering the table at a different width than Safari or IE. Why it's doing so is the question.
If you put a border around the table you can visually check it.
(style="border:1px solid black")

The answer might be to style the table a certain way in the style sheet so that all three render the table at the same width.

Also - if you're using a doctype - remove it and see if the same values are still coming up.

Without seeing the whole thing - that's the best I can tell you.

Joe Belmaati

3:05 pm on Jun 11, 2008 (gmt 0)

10+ Year Member



Thanks for your reply. The problem here is that the table will be a different width depending on whether or not a user has posted images to the blog/forum. I don't want to resize the images in real-time using gd and php because it renders too slowly. I'll try and remove the doctype and see what happens. Thanks for the suggestion.

Joe Belmaati

6:37 pm on Jun 11, 2008 (gmt 0)

10+ Year Member



Hello,
no difference regardless of DOCTYPE including no DOCTYPE...

any ideas? Thanks a lot.

Joe Belmaati

10:55 am on Jun 16, 2008 (gmt 0)

10+ Year Member



BUMP * (...is that allowed..?)