Previous | Next | (P-PDF) JavaScript
Topic: Re: Rounding off to the nearest decimal point (Via Email)
Conf: (P-PDF) JavaScript, Msg: 28524
From: prodok
Date: 10/13/2001 10:19 PM
The Math object in JavaScript has the round() method, which rounds to
the next integer. In order to get your desired rounding, you multiply
with a factor so that you can round to the integer, round, and divide
again, and you will get the desired result.
Note that this is different from the Formatting of your number. In
the Formatting, only the displayed value is rounded, but the value
itself is not. With the round() function you actually change the
value.
This differentiation can be important when you do further calculations.
Hope, this can help.
Max Wyss
PRODOK Engineering
Low Paper workflows, Smart documents, PDF forms
CH-8906 Bonstetten, Switzerland
Fax: +41 1 700 20 37
e-mail: mailto:max@prodok.com
http://www.prodok.com
[ Building Bridges for Information ]
______________________
Shameless Plug:
I will have presentations and pre- and post-conference workshops at
the .PDF2001 West Conference in Scottsdale, AZ, Nov. 5 to 7, 2001.
More details at http://www.pdfconference.com.
Workshops:
Nov. 4: Implementing Business Processes based on PDF
Nov. 8: Enhancing PDF Forms
_________________________
>In creating a number times a percentage I need to have the number
>round of 2 decimal points. What do I need to insert to obtain this?
>
>My present script reads:
>
>var f = this.getField("Cash.1");
>event.value = f.value /1.77 * 0.47;
>
>Any help will be greatly appreciated.
>