In Javascript width should not default to px considering you can also use em, px and %.
This won't help with your units issue but if you want Javascript to give more errors, try strict mode. Add: "use strict"; as the first line in your file.
You are probably in a tight deadline but if you ever get the time, and if you haven't yet, the Tutorials and guides in MDN are really really good.
MDN: JavaScript Guide
MDN: Intermediate
MDN: Advanced