Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    North East England
    Posts
    853
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JavaScript Request: unit conversion

    Hi
    I'd like a script to convert any 1 of 4 values into its equivalents. I've managed to do this by converting and hacking up a temperature script from JSK but there's a bug as I'm involving 4 different units and the script I manipulated dealt with 3 and frankly my JS knowledge is *limited*

    Here's what I had:
    PHP Code:
    <table>
    <
    tr><td width="175"><p align="right">Newton meters (Nm):</p></td>
    <
    td>
    <
    INPUT TYPE="text" NAME="Nm" VALUE="" SIZE="9" MAXLENGTH="9" onChange="eval('lbin.value = ' + this.form.lbin_expr.value);eval('lbft.value = ' + this.form.lbft_expr.value);eval('ozin.value = ' + this.form.ozin_expr.value)">
    <
    INPUT TYPE="hidden" NAME="Nm_expr" VALUE="(ozin.value / 141.69)">
    </
    td></tr>
    <
    tr><td>
    <
    p align="right">Pound feet (Lb/ft):</p></td>
    <
    td>
    <
    INPUT TYPE="text" NAME="lbft" VALUE="" SIZE="9" MAXLENGTH="9" onChange="eval('Nm.value = ' + this.form.Nm_expr.value);eval('lbin.value = ' + this.form.lbin_expr.value);eval('ozin.value = ' + this.form.ozin_expr.value)">
    <
    INPUT TYPE="hidden" NAME="lbft_expr" VALUE="((Nm.value * 8.85)/12)">
    </
    td></tr>
    <
    tr><td>
    <
    p align="right">Pound inches (Lb/in):</p></td>
    <
    td>
    <
    INPUT TYPE="text" NAME="lbin" VALUE="" SIZE="9" MAXLENGTH="9" onChange="eval('Nm.value = ' + this.form.Nm_expr.value);eval('lbft.value = ' + this.form.lbft_expr.value);eval('ozin.value = ' + this.form.ozin_expr.value)">
    <
    INPUT TYPE="hidden" NAME="lbin_expr" VALUE="(Nm.value * 8.85)">
    </
    td></tr>
    <
    tr><td>
    <
    p align="right">Ounce inches (oz/in):</p></td>
    <
    td>
    <
    INPUT TYPE="text" NAME="ozin" VALUE="" SIZE="9" MAXLENGTH="9" onChange="eval('Nm.value = ' + this.form.Nm_expr.value);eval('lbft.value = ' + this.form.lbft_expr.value);eval('lbin.value = ' + this.form.lbin_expr.value)">
    <
    INPUT TYPE="hidden" NAME="ozin_expr" VALUE="((lbft.value * 12)* 16)">
    </
    td></tr>
    <
    tr>
    <
    td colspan="2">
    <
    hr>
    </
    td>
    </
    tr>
    <
    tr>
    <
    td colspan="2" align="right">
    <
    INPUT TYPE="button" NAME="Reset" VALUE="Submit">
    <
    INPUT TYPE="Reset" NAME="Reset" VALUE="Reset">
    </
    td></tr>
    </
    table
    Any assistance I'd be grateful for.

    Also if it's possible to do so more values can be added as and when that would be good
    Last edited by mouse; 07-07-2002 at 01:05 AM.
    [+] Computer/PC issues [+] Silverpaw3D
    ------------------------------------------------
    Never buy a dwarf with learning disabilities...

    ...it's not big, and it's not clever.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    mou...
    one thing /me just a noticed®??? you donttt have just a ny® <form> n' </form> tags...:O(((
    The New JustaBuster Version 2.0 OR JustaBusta Lite V2.0
    ...just a special® thanx kinda hugs to jkd n' nex ...:O)))

    CommemorateWTC.com --Please lend your support

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    North East England
    Posts
    853
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I do, just outside the table, the script works but has a couple of bugs such as not converting from Oz/in.
    [+] Computer/PC issues [+] Silverpaw3D
    ------------------------------------------------
    Never buy a dwarf with learning disabilities...

    ...it's not big, and it's not clever.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •