Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Where to start making a Javascript Diabestes Risk Calculator

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #158710
    ollieginge
    Participant

    Hi, I am new to Javascript and need to make a diabetes risk calculator.
    I Have a form with radio buttons in HTML the user selects 1 of 4 answers per question.

    On submission based on their answers it returns a block div underneath stating the risk etc.

    I have no idea where to begin to make the javascript achieve this?

    Could anyone help guide me as the study notes I have don’t cover this topic.

    Do I use an array, function, if statement?

    I think i do this but don’t know how to do the calulation

    document.getElementById(“age”).select();

    Any help or tips would be great please

    Thanks

    #158743
    nkrisc
    Participant

    Based on the limited information provided, I can tell you with some confidence you will probably need to use arrays, functions, and IF statements.

    How is risk calculated based on the their responses? Do you just need to add up all the corresponding values? Is it weighted? Where’s your HTML?

    document.getElementById("age") will return that element from the DOM, but what do you want to do with it? I’m guessing you want its value.

    var age = document.getElementById("age").value

    Once you have that variable, what do you want to do with it? Multiply it times a billion?

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.