0
<!doctype html>
<html>
<head>
<script src="myscripts.js"></script>
</head>
<body>
<label for="valor1">Celcius <strong>1</strong>:</label>
<input type="text" name="valor1" id="valor1" />
<label for="res">Kelvin:</label>
<input type="text" name="res" id="res" />
<input type="button" value="Calcular" class="botao" onClick="calcular(document.calcform.oper.value)"/>
</body>
</html>
javascript function calcular(oper) {
var kelvin = 273;
var valor1 = document.calcform.valor1.value;
var res = valor1 + kelvin;
console.log(res);
document.calcform.res.value = res;
}
You use
document.calcform
in Javascript, but in HTML there is no calcform...– hkotsubo
Thank you very much!
– Antoine