2
I’m trying to make a very simple example of javascript but the innerhtml is not being recognized.
<!DOCTYPE html>
<html>
    <head>
            <title>Pagina com Javascript</title>
            <script src="meujavascript.js"></script>
            <!-- Versao do JS <script type="text/javascript" language="JavaScript1.8.5"></script> -->
    </head>
    <body>
    <!--
    <p id="paragrafo">texto em javascript</p>
    <button type="button" onclick="mostrar()">Teste</button>
    -->
    <p id="valores">[valores]</p>
    </br></br></br>
    <button type="button" onclick=adicionar(1,2)">Mensagem</button>
    </body>
</html>
Javascript function:
function adicionar(parcela1, parcela2)
{
    //esta função adiciona dois valores
    var resultado = parcela1 + parcela2;
    var test document.getElementById("valores");
    test.innerhtml = resultado;
}
Very simple HTML just for practice.
My javascript example. I want to continue practicing but I don’t know why innerhtml isn’t working.. Someone can help me ?
innerhtmlmust be withHTMLgreat. =>innerHTML– Sergio