AvailabilityDOM Level 2 CSS Synopsisfloat getFloatValue(unsigned short unitType) throws DOMException; Arguments
ReturnsThe floating-point numeric value of this CSSPrimitiveValue, expressed in the specified units. ThrowsThis method throws a DOMException with a code of INVALID_ACCESS_ERR if this CSSPrimitiveValue holds a non-numeric value, or if the value cannot be converted to the requested type of units. (See the next section for more about unit conversion.) DescriptionFor CSSPrimitiveValue objects that hold numeric values, this method converts those values to the specified units and returns the converted values. Only certain types of unit conversions are allowed. Lengths may be converted to lengths, angles to angles, times to times, and frequencies to frequencies. Obviously, however, a length measured in millimeters cannot be converted to a frequency measured in kilohertz. Also, not all lengths can be converted. Relative lengths (lengths measured in ems, exs, or pixels) can be converted to other relative lengths but cannot be converted to absolute lengths. Similarly, absolute lengths cannot be converted to relative lengths. Finally, percentage values cannot be converted to any other unit type, except for color percentage values, which express a percentage of 255 and can be converted to the CSS_NUMBER type. |