...

View Full Version : how to keep trailing zeros and Math.round?



pell
10-07-2008, 03:51 PM
Am filling in for someone and don't know Javascript -- have looked for hours on boards but can only find an answer for a single variable.

Issue: 2 decimal points showing everywhere except when the output has .00 at the end. How do I get those zeros to show? Here is the math code:



for (var p in output_data) {
$('#'+p).html(Math.round(output_data[p]*100)/100);


All of the source code is viewable here:

http://www.interactivesystems.biz/is/tvupload.php

Folder is protected:
user = is
pass = michael11

Please see the Sony Projector section - the first item subtotal should be 3875.00 and comes out as just 3875 when you choose a Quantity of 1.

I am really stuck and would be very, very appreciate of any assistance. Thanks so much.

rnd me
10-07-2008, 05:10 PM
Math.round(output_data[p]*100)/100
should be:
(Math.round(output_data[p]*100)/100).toFixed(2);

pell
10-07-2008, 05:18 PM
Thanks so much for the response, but using that code turns all tax and subtotal fields to 0?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum