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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If, then, else help (maybe.)

    So I'm trying to make this "script" where you are able to input numbers into the form, click the calculate button and with some javascript math it is able to use a formula to output the answer.

    The calculations are for a milling machine which uses the formulas as a guide line for operating speeds. The answers are in specified units and the formulas differ depending on if you're using the metric system or imperial system.

    Ideally (this is where I need help) there is 2 radio buttons at the top of the form which you can toggle to and from metric and imperial and in turn the formula being used would switch causing the answer to be in either millimeters or inches.

    I was wondering if anyone could provide some insight into how I could go about this. My JS knowledge is probably a 0.2 on a scale of 1-10 so any help would be greatly appreciated. What I believe to be the answer is some if,else statements but any other suggestions are welcome. Thanks in advance =/

    Hosted online: http://jsbin.com/iquxu4/edit

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,474
    Thanks
    13
    Thanked 361 Times in 357 Posts
    first of all, there are some other problems to tackle first:

    - nested <form>s are not allowed
    - <font> is outdated (use CSS instead)
    - the language attribute is outdated too (use type="text/javascript" instead)
    - the with() construct is unnecessary
    - your JavaScript does an early start, thus it effectively kills itself
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


  •  

    Posting Permissions

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