2
I need the result of the transformation to appear when I click the Calculate button.
HTML
<div id="principal">
    <form id="form">
        <input id="valorX" type="text" size="15" />
        <select id="conversao">
            <option id1="valor" value="">escolha uma conversao</option>
            <option id2="valor" value="1">F->C</option>
            <option id3="valor" value="2">C->F</option>
        </select>
        <input id="resultado" type="text" size="15" disabled="true" />
        <input id="calcular" type="button" value="Calcular" onclick="opcao()" />
        <input id="limpar" type="reset" value="Resetar" />
    </form>
</div>
Javascript
function opcao() {
    if (document.getElementById("conversao").value == "") {
        alert("Selecione uma conversão");
    }
    if (document.getElementById("conversao").value == "1") {
        if (valida()) {
            FC();
        }
    }
    if (document.getElementById("conversao").value == "2") {
        if (valida()) {
            CF();
        }
    }
}
function valida() {
    if (document.getElementById("valorX").value == "" || document.getElementById("valorX").value == "") {
        alert("Valor não informador");
        return false;
    } else {
        if (validanumero()) {
            return true;
        } else {
            return false;
        }
    }
}
function validanumero() {
    var valorX = document.getElementById("valorX").value;
}
//}
function FC() {
    var valorX = document.getElementById = "2" ("valorX").value;
    var resultado = (valorX / 5 = (valorX - 32) / 9)
    document.getElementById("resultado").value = resultado;
}
function CF() {
    var valorX = document.getElementById("valorX").value;
    var resultado = (valorX / 5 = (valorX - 32) / 9)
    document.getElementById("resultado").value = resultado;
}
Can you explain what you want this line to do
var resultado = (valorX / 5 = (valorX - 32) / 9)?– Sergio
I want the physical transformation fraction from ºC to ºF
– João Oliveira