Your problem is that by doing onchange
you are always passing two string’s, so you will multiply the value of the input you are passing (correctly) plus two strings.
Your mistake was:
onchange="MudaPreco(this.value,'txt_Largura_1','txt_Inclinicacao_1','PrecoProd_1')
And what the job was gonna get:
function MudaPreco(4, txt_Largura_1, txt_Inclinicacao_1, PrecoProd_1)
So as you calculate var Total
stayed:
var Total = 4* txt_Largura_1* txt_Inclinicacao_1
Here’s what I advise you to do:
comprimentoID = $('#txt_Comprimento_1').val();
LarguraID = $('#txt_Largura_1').val();
InclinacaoID = $('#txt_Inclinicacao_1').val();
var Total = comprimentoID * LarguraID * InclinacaoID;
I leave JSFIDDLE with an example of resolution.
EDIT: Without the Jquery
You can use the document.getElementById('txt_Comprimento_1').value
which is native to javascript.
LINK without jquery.
Your problem is that by onchangeing an element you are passing a string and not a content
– CesarMiguel
I believe you will have to do the onchange only at the last to have all 3 parameters if it will not have way
– Otto