0
<script type="text/javascript">
function somarValores(){
var s1 = document.getElementById("s1").value;
var s2 = document.getElementById("s2").value;
var s3 = parseInt(s1) + parseInt(s2);
return s3;
}
</script>
<fieldset>
<legend>Cálculo do salário</legend>
<label>Valor 1:</label>
<input id="s1" type="text"/>
<label>Valor 2: </label>
<input id="s2" type="text"/>
<label>Resultado: </label>
<input id="resultado" onclick="somarValores()" type="text">
</fieldset>
you have done practically all the work, just need to show the result, put in a field, an Alert, console.log? a Function is returning to no one, instead of Return try to show the result. now you put in the question "float type", but you’re using
parseInt
, why notparseFloat
?– Ricardo Pontual