Forum Moderators: open

Message Too Old, No Replies

FF Errors for left and top

Help!

         

colandy

11:02 am on Jun 19, 2007 (gmt 0)

10+ Year Member



I seem to have an issue in Firefox, god knows why. Unfortunately God wasn't available so thought I'd ask his minions instead.

The error console states the following:

Error in parsing value for property 'left'. Declaration dropped

Not really all that helpful as I'm trying to position a div at an absolute position in JS.

the command I'm using is:

obj.style.cssText="position: absolute; left:515; top:20;";

Works in IE and on a different site I have in both IE and FF, but this one doesn't.

SuzyUK

11:25 am on Jun 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



perhaps you need to add the units?

left: 515px; top: 20px;

colandy

11:47 am on Jun 19, 2007 (gmt 0)

10+ Year Member



OK, now I'm confused. Why in one app I need the px's and the other I don't.

Although it now works, any idea's why the difference.?!?

PS - Thanks for the help.

Bernard Marx

12:01 pm on Jun 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The CSS standards say that units must be specifically declared. FF is very strict about this, and won't accept plain numbers. IE lets you get away with it (assumes px). It's that simple!

colandy

12:10 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



But I get away with it in one app and not the other.

Bernard Marx

1:57 pm on Jun 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Precisely. They are different apps, with different implementations.

[edited by: Bernard_Marx at 1:58 pm (utc) on June 19, 2007]

colandy

2:17 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



right, so I have two apps doing essentially the same thing, both specify left and top.

One specifies px and the other doesn't.

Open them both in FF and both work fine.

However if I remove the px's from the one so that both have no px's one works and one doesn't.

I don't understand how one can work and one fails if the styles are exactly the same regarding the px's.

Doh! Just figured it out. One has a Document Tag and the other doesn't. Guessing that's what caused the problem.

OK, so I gues I need to change my coding ethic.

Bernard Marx

4:28 pm on Jun 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry there, colandy, I misunderstood the meaning of "app".

Yes indeed. It looks like the use of a doctype in the one case is triggering "strict mode" in Firefox.