Answer for Error: Error in parsing value for property 'width'. Declaration dropped.
January 15, 2006
Firefox 1.5 has introduced a whole panel of pain in the ass headaches lately. One of which was the msg Error: Error in parsing value for property 'width'. Declaration dropped.
or Error: Error in parsing value for property 'height'. Declaration dropped.
To fix this it seems you have to also include the unit of measure when you're dynamically changing the width in javascript
as:
INSTEAD OF:
this should take care of those pesky messages
or Error: Error in parsing value for property 'height'. Declaration dropped.
To fix this it seems you have to also include the unit of measure when you're dynamically changing the width in javascript
as:
document.getElementById('mydiv').style.width= '400px';
INSTEAD OF:
document.getElementById('mydiv').style.width= 400;
this should take care of those pesky messages
Nobody says:
March 6, 2006 @ 17:39 — Reply
Thanks. Just what I needed. ^_^
T-max says:
February 21, 2010 @ 16:03 — Reply
I am having this problem, can someone please tell me where you make this entry adjustment, I has assumed it was by using about:config, but on checking I do not have this entry at all, thanks
FernandoBR says:
March 16, 2006 @ 05:08 — Reply
Much thanks for the info.
Anonymous says:
April 11, 2006 @ 11:42 — Reply
Thanks for posting your find!!
many thanks says:
May 6, 2006 @ 04:18 — Reply
many thanks!
Aaron says:
May 10, 2006 @ 17:59 — Reply
Thanks very much!
Naich says:
June 1, 2006 @ 07:30 — Reply
Thanks! I've been tearing my hair out for the past 2 hours with this one.
Kev says:
June 9, 2006 @ 14:52 — Reply
Thank you! Oops. Good ol' doing things exactly the right way. Kev
Michael John says:
June 15, 2006 @ 16:52 — Reply
Jim! You simply rock brother! You gotta love the net and people like Jim! Peace not pieces, Michael John.
Brad says:
July 12, 2006 @ 22:35 — Reply
THANKS! Found you via a Google search.
Anonymous says:
July 19, 2006 @ 08:10 — Reply
For anybody who use some developer toolbar in firefox (for example: web developer) You got the same javascript error, if any inline css height/width etc. auttribute has no unit! This is confusing because this is not a javascript error rather than a css syntax error.
replica watches says:
June 21, 2010 @ 23:56 — Reply
Comment pending moderation
jewellery earrings says:
June 25, 2010 @ 01:38 — Reply
Comment pending moderation
Dino says:
August 9, 2006 @ 11:27 — Reply
Well done, Jim. As someone else said, I found this page through Google, and you've saved me a fair bit of head-scratching time with your post. Thanks loads!! :)
Anonymous says:
August 18, 2006 @ 08:24 — Reply
Gracias.-
Nate says:
August 31, 2006 @ 14:19 — Reply
Cool, thanks for this tip
Mike says:
September 15, 2006 @ 05:40 — Reply
There are no such problems with a doctype of: When you adhere to the standards and use a doctype of: that’s when you see this problem. To be standards compliant the unit of measure is mandatory. I was converting an old HTML page to XHTML and came across this problem. Thanks to this page I resolved it.
James says:
September 16, 2006 @ 12:36 — Reply
Wish I'd entered the error message in my google search last week when I spent the whole day trying to find the cause of this! Because the script loops, there would be 300-400 or more errors generated on a page. Although our script is over 5 years old we haven't worried about non-IE behavior for this purely cosmetic snowing script until now. Now that it is fixed, the repaired script will be installed in the next week, initially on our sitemap.. Many thanks!
JasperGlo says:
October 5, 2006 @ 16:10 — Reply
I'm not a programmer of any kind, and certainly not familiar with computer language. How then, if possible, do I resolve this error problem with my Mozilla browser based on this information?
dragomir says:
October 9, 2006 @ 16:13 — Reply
yeah, i love you for this! i was looking for solution whole evening and finally - here it is! this is so stupid of firefox to write all properties in strings :|
Mark Lorenz says:
October 23, 2006 @ 17:46 — Reply
JasperGlo: Have you tried running firefox from a console as root? That did the trick for me. After you've run as root once, you can go back to running firefox as a user.
Daemeon says:
November 8, 2006 @ 08:18 — Reply
Firefox is broken on Gmail, eBay, Amazon as of V 2.0. Product dead, reverting to other browsers.
Starke says:
February 11, 2007 @ 21:39 — Reply
Good fix... thank, I'd been working on a script and I couldn't get this worked out until I saw off the tools-> Javascript Console, which gave the error... which I searched and found the solution on your page. Thanks for the straight-forward answer.
sandy says:
March 1, 2007 @ 15:10 — Reply
Mike is right. Adding a proper doctype will fix this:
yuriy says:
March 15, 2007 @ 16:31 — Reply
Thanks for this tip - just solved my problem!
steve says:
April 3, 2007 @ 07:53 — Reply
thank you thank you thank you thank you thank you thank you thank you thank you thank you. Was at the brink of banging my head against a wall wondering why my floating div box wouldn't move around my page. Muchios Gracius
Don says:
May 1, 2007 @ 13:30 — Reply
Thanks for the solution! I was also wondering if anyone knows how to do this dynamically? I am using a onResize function that resizes a middle window (sandwiched between a header and a footer) based on the window size. If I do "my_div.style.height = '500px;" the code works fine (in IE and firefox) but sets to 500px all the time. So I've tried "var itemHeight= document.body.clientHeight - top_space - bottom_space + 'px';"" then next line is "my_div.style.height = iemHeight;" It works as expected in IE6 but in firefox I continue to get the error described above. I'd apprecitate any help anyone might have on this. Thanks.
Don says:
May 1, 2007 @ 14:51 — Reply
Sorry, my bad. Turns out your solution was 100% even for doing it dynamically. The "issue" was due to my use of "document.body.clientHeight". IE interpreted this as the size of the browser, FireFox seemed to interpret it as only my header div tag size. So I basically had to do browser detection. When it is IE I use the code above, when FireFox I use "window.innerHeight" instead if "document.body.clientHeight" Either way you're solution fixed my main problem and I wish I'd found it sooner. Thanks again!
francesco says:
July 25, 2007 @ 13:18 — Reply
Thanks man, that really helped. It's strange, I have two pages. On the first it works w/o the 'px' but not in the other... ??? precising px makes it work on both though and IE as well. Thanks again :)
Pete says:
September 5, 2007 @ 14:51 — Reply
Just what I was looking for, awesome. For anyone else having problems with this, if you get a value of an element.style.attrib and then are having trouble manipulating it, you need to split the string to allow it. google 'javascript string split' and you'll have it fixed in no time. split out the existing px, manipulate the value, then add the px back again. sorted!
Jeff says:
September 11, 2007 @ 06:33 — Reply
Just another thanks. Was stuck with the same error, found this page on Google and my scripts working a dream now.
Anonymous says:
July 22, 2009 @ 10:35 — Reply
Thank you SOOOO much! It's weird; I was working on a page last night, and suddenly it stopped working. I have no idea what I did, but I'm sure that it used to work without appending +"px". Oh, well. I did what you said and it works again!
mattyoaces says:
December 6, 2009 @ 23:15 — Reply
how do u correct the problem i seriouslly wouldnt have a clue. I wish i knew as it is a real pain.
blu ray ripper says:
April 18, 2010 @ 04:05 — Reply
Comment pending moderation
help says:
May 2, 2010 @ 02:58 — Reply
Comment pending moderation
642-062 says:
May 19, 2010 @ 00:57 — Reply
Comment pending moderation
nenitz says:
May 23, 2010 @ 19:52 — Reply
Comment pending moderation
wholesale laptop adapter says:
May 29, 2010 @ 00:19 — Reply
Comment pending moderation
virbram five fingers says:
June 4, 2010 @ 20:18 — Reply
Comment pending moderation
Ed Hardy says:
June 7, 2010 @ 18:45 — Reply
Comment pending moderation
MKV to iPad says:
June 9, 2010 @ 00:55 — Reply
Comment pending moderation
LOUIS VUIttON OnlinE says:
June 9, 2010 @ 22:49 — Reply
Comment pending moderation
E20-322 says:
June 12, 2010 @ 18:07 — Reply
Comment pending moderation
coach purses says:
June 17, 2010 @ 03:00 — Reply
Comment pending moderation
Replica Jewelry says:
June 21, 2010 @ 00:19 — Reply
Comment pending moderation
christian louboutin shoes says:
June 23, 2010 @ 17:05 — Reply
Comment pending moderation
chanel handbags says:
June 23, 2010 @ 17:17 — Reply
Comment pending moderation
air max says:
June 24, 2010 @ 01:37 — Reply
Comment pending moderation
rolex watches says:
June 24, 2010 @ 03:00 — Reply
Comment pending moderation