code: function getSizeInPixels(el, value) {
      if (/px$/i.test(value)) return parseFloat(value);
      var style = el.style.left, runtimeStyle = el.runtimeStyle.left;
      el.runtimeStyle.left = el.currentStyle.left;
      el.style.left = value;
      var result = el.style.pixelLeft;
      el.style.left = style;
      el.runtimeStyle.left = runtimeStyle;
      return result;
    }
docs: Original by Dead Edwards. Combined with getFontSizeInPixels it also works with relative units.