One more Javascript function
This function will format a value expressed as feet (with decimals) into feet and inches.
// Convert feet (decimal) into feet and inches function toString(value) { var abs = Math.abs(value); // Round to nearest 0.1 inch var rounded = Math.round(120 * abs) / 120; var feet = Math.floor(rounded); var inches = 12*(rounded - feet); return (value < 0 ? "-" : "") + (feet != 0 ? feet + "'" : "") + (inches.toFixed(1) + '"'); }
Comments are closed.