Rule of three don't work javascript
The document it's not alerting the result. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <input type="radio" id="inv">Inversamente</input> <input type="radio" id="dir">Diretamente</input><br /> <input type="text" id="I1"></input> <input type="text" id="I2"></input><br /> <input type="text" id="I3"></input> <input type="text" id="I4"></input><br /><br /> <button id="button" onclick="button()">Calcular</button> <script type="text/javascript"> function button(){ var i1 = document.getElementById("I1"); var i2 = document.getElementById("I2"); var i3 = document.getElementById("I3"); var i4 = document.getElementById("I4"); var i5 = document.getElementById("inv"); var i6 = document.getElementById("dir"); if (i1.value == "x" && i5.value === true || i1.value =="y" && i5.value === true){ var r1 = i3.value*i4.value/i2.value; alert("Resultado Ă© " + r1); } else if (i1.value == "x" && i6.value === true || i1.value =="y" && i6.value === true) { var r2 = i3.value*i2.value/i4.value; alert("Resultado Ă© " + r2); } else if (i2.value == "x" && i5.value === true || i2.value =="y" && i5.value === true){ var r3 = i3.value*i4.value/i1.value; alert("Resultado Ă© " + r3); } else if (i2.value == "x" && i6.value === true || i2.value =="y" && i6.value ===true) { var r4 = i1.value*i4.value/i3.value; alert("Resultado Ă© " + r4); } else if (i3.value == "x" && i5.value === true || i3.value =="y" && i5.value === true){ var r5 = i1.value*i2.value/i4.value; alert("Resultado Ă© " + r5); } else if (i3.value == "x" && i6.value === true || i3.value =="y" && i6.value === true) { var r6 = i1.value*i4.value/i2.value; alert("Resultado Ă© " + r6); } ...