Skip navigation
Currently Being Moderated

Round sum to 2 decimal places

May 5, 2013 10:58 PM

I've got this sum for a 'shopping cart' style design and want the prices to round to 2 decimal places

I know I've got to put Math.round... in somewhere, but I just don't know

 

Script:

 

<script type="text/javascript"><!--

function updateultra() {

document.form.ultra.value = (document.form.sum1.value -0) * (1.79);  }

//--></script>

 
Replies
  • Currently Being Moderated
    May 6, 2013 3:59 AM   in reply to kat new

    <script>

    function updateultra() {

        document.form.ultra.value = Math.round((document.form.sum1.value -0) * (1.79))

    }

    </script>

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points