Need to get this calculator to round to 2 decimels

Discussion in 'Java' started by Yonih, Sep 10, 2008.

  1. Yonih

    Yonih Guest

    Can anyone help me change this script to round to 2 decimals. Thanks
    in advance


    <FORM ACTION="..." METHOD="post">
    <TABLE CELLSPACING="1" CELLPADDING="4">
    <TR ALIGN="center" VALIGN="middle">
    <TD><STRONG>Millimeters</STRONG></TD>
    <TD>&nbsp;</TD>
    <TD><STRONG>Inches</STRONG></TD>
    <TD>&nbsp;</TD>
    </TR>
    <TR ALIGN="center" VALIGN="middle">
    <TD><INPUT TYPE="text" NAME="milli" SIZE="12" VALUE="25.4"
    onChange="inch.value = eval(this.value) / 25.4"></TD>
    <TD>=</TD>
    <TD><INPUT TYPE="text" NAME="inch" SIZE="12" VALUE="1.00"
    onChange="milli.value = 25.4 * eval(this.value)"></TD>
    <TD><INPUT TYPE="reset" VALUE="&nbsp;Reset&nbsp;"></TD>
    </TR>
    <TR ALIGN="center" VALIGN="middle">
    <TD COLSPAN="3"><INPUT TYPE="button" VALUE="Convert"></TD>
    <TD>&nbsp;</TD>
    </TR>
    </TABLE>
    </FORM>
     
    Yonih, Sep 10, 2008
    #1
    1. Advertising

  2. Yonih wrote:
    > Can anyone help me change this script to round to 2 decimals. Thanks
    > in advance
    >
    >
    > <FORM ACTION="..." METHOD="post">
    > <TABLE CELLSPACING="1" CELLPADDING="4">
    > <TR ALIGN="center" VALIGN="middle">
    > <TD><STRONG>Millimeters</STRONG></TD>
    > <TD>&nbsp;</TD>
    > <TD><STRONG>Inches</STRONG></TD>
    > <TD>&nbsp;</TD>
    > </TR>
    > <TR ALIGN="center" VALIGN="middle">
    > <TD><INPUT TYPE="text" NAME="milli" SIZE="12" VALUE="25.4"
    > onChange="inch.value = eval(this.value) / 25.4"></TD>
    > <TD>=</TD>
    > <TD><INPUT TYPE="text" NAME="inch" SIZE="12" VALUE="1.00"
    > onChange="milli.value = 25.4 * eval(this.value)"></TD>
    > <TD><INPUT TYPE="reset" VALUE="&nbsp;Reset&nbsp;"></TD>
    > </TR>
    > <TR ALIGN="center" VALIGN="middle">
    > <TD COLSPAN="3"><INPUT TYPE="button" VALUE="Convert"></TD>
    > <TD>&nbsp;</TD>
    > </TR>
    > </TABLE>
    > </FORM>


    Right, you'll be wanting the javascript newsgroups.

    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
     
    Joshua Cranmer, Sep 10, 2008
    #2
    1. Advertising

  3. On Sep 11, 1:12 am, Yonih <> wrote:
    > Can anyone help me change this script to round to 2 decimals.  


    That sounds like JavaScript you are referring to.

    You have the wrong group.
    <http://pscode.org/javafaq.html#js>

    --
    Andrew Thompson
    http://pscode.org/
     
    Andrew Thompson, Sep 10, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,130
  2. Rafael

    Need help with my Calculator program.

    Rafael, Dec 2, 2003, in forum: C Programming
    Replies:
    6
    Views:
    411
    osmium
    Dec 4, 2003
  3. conspawn

    NEED HELP WITH CALCULATOR WEB SERVICE

    conspawn, May 24, 2005, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    134
    conspawn
    May 25, 2005
  4. OliverMarchand

    Float.round - should it be round-to-even

    OliverMarchand, Apr 12, 2006, in forum: Ruby
    Replies:
    2
    Views:
    252
    OliverMarchand
    Apr 12, 2006
  5. cerr

    reading file round and round

    cerr, Mar 19, 2010, in forum: Perl Misc
    Replies:
    6
    Views:
    200
    Peter J. Holzer
    Mar 20, 2010
Loading...

Share This Page