1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help with calculation

Discussion in 'HTML & JavaScript' started by QWERTYMD, Feb 4, 2015.

  1. QWERTYMD

    QWERTYMD Newbie

    Joined:
    Jun 14, 2011
    Messages:
    2
    Likes Received:
    0
    Hello,
    I've created online calculator, but for some reasons calculations are all of. Maybe someone knows what is wrong with it?

    Code:
     if (document.getElementById("RadioGroup1_0").checked == true) {
    if (document.getElementById("RadioGroup2_1").checked == true) {if (document.getElementById("RadioGroup3_0").checked == true) {document.getElementById("output").innerText=Math.round(x*37*0.85);}{document.getElementById("c").innerText=Math.round((((x*37*0.85)-(x*10.2+x*7.65))*0.25));}{document.getElementById("o").innerText=Math.round(x*3*0.85);}{document.getElementById("a").innerText=Math.round(x*1*0.85);}}
            
    
    if (document.getElementById("RadioGroup2_2").checked == true) {if (document.getElementById("RadioGroup3_0").checked == true) {document.getElementById("output").innerText=Math.round(x*40*0.85);}{document.getElementById("c").innerText=Math.round((((x*40*0.85)-(x*10.2+x*7.65))*0.25));}{document.getElementById("o").innerText=Math.round(x*3*0.85);}{document.getElementById("a").innerText=Math.round(x*1*0.85);}}
            }
     
  2. lightning37

    lightning37 Newbie

    Joined:
    Dec 12, 2014
    Messages:
    21
    Likes Received:
    4
    It would be helpful to see the html that goes along with the javascript you've posted. I would recommend either posting a URL to the live calculator or post it on CodePen(hxxp://codepen.io/).