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
    New to the CF scene
    Join Date
    Jul 2006
    Location
    skipton
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I need some help please trying to get this converted rrom metric to imperial Please

    Urgent please. Bimbo on code. Can any one help me please my brain is shutting down now after working on this all night. Im a lil bit of a newbie here so i was hoping if you guys could help me .Is there any way to do this script in both metric and imperial as it wouuld prove usefull to my draugthsmen at my work environment any help in this matter would be fantastic

    My e-mail is alimcvev@hotmail.com

    HTML>
    <HEAD>
    <TITLE>example </TITLE>
    <SCRIPT type="text/javascript">
    var shapeArray = new Array (5);
    var RectangleLength;
    var RectangleWidth;
    var sum1;
    var sum2;
    var sum3;
    var circle;
    function test(){
    for (var i= 0; i< shapeArray.length; i++){
    Mesure=window.prompt('Please enter the format of the size ("M" for metric or "I" for imperial)');

    shape=window.prompt('Please enter shape "r" for rectangle or "c" for Circle');
    if(shape=='r'){
    RectangleLength = window.prompt('Please enter the length of the rectangle in centimetres','');
    while(mesure== I * 2.54)
    RectangleLength=parseFloat(RectangleLength);
    RectangleWidth = window.prompt('Please enter the width of the rectangle in centimetres','');
    while(mesure== I * 2.54)
    RectangleWidth=parseFloat(RectangleWidth);
    shapeArray[i]='The area of the '+shape+' is ' +RectangleLength * RectangleWidth+ ' square centimetres <br>'
    }
    while(mesure== I * 2.54)
    if (shape=='c'){
    circle = window.prompt('Please enter the radius','');
    circle=parseFloat(circle);
    shapeArray[i]='The radius of the circle is '+circle * circle * 3.142+'<br>'
    }
    document.getElementById("display").innerHTML+=shapeArray[i]
    }
    }
    document.write('<BR>' + 'Thank you for using this program')
    </SCRIPT>
    </HEAD>
    <BODY onload="test()">
    <div id="display"></div>
    </BODY>
    </HTML>
    Last edited by Alimcvev; 07-19-2006 at 04:52 PM. Reason: i need it for the office

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,495
    Thanks
    3
    Thanked 500 Times in 487 Posts
    not understaning this as if you leave out the units promps

    the calculation will be correct for whatever units are used

    ie
    2 inch *3 inch = 6 inch

    2 cm * 3 cm = 6 cm
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #3
    New to the CF scene
    Join Date
    Jul 2006
    Location
    skipton
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I realy need to get a metric result from the imperial value. Therefore multiplying the end result of an imperial mesurement. Basicaly in the case of an imperial number added to the program multiplying this by 2.54


  •  

    Posting Permissions

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