There is a code for a simple conversion (Farenheit to Celcius) in HTML. I am working to recreate the same thing in Solidity. I would need some pointers in making it work. The solidity Code is as follows:
contract TemperatureSolution{ uint16 input,function convertTemp(uint16 _input) public{ return (document.getElementById("outputCelcius").innerHTML=(valNum-32)/1.8) } convertTemp(_input);
}
For reference, the HTML that it is based upon is as follows (this works, but I intend to create it on a blockchain):
<html>
<body>
<p>Type a value in the Fahrenheit field to convert the value to Celsius:</p>
<p>
<label>Fahrenheit</label>
<input id=“inputFahrenheit” type=“number” placeholder=“Fahrenheit” oninput=“temperatureConverter(this.value)” onchange=“temperatureConverter(this.value)”>
</p>
<p>Celcius: <span id=“outputCelcius”></span></p><script> function temperatureConverter(valNum) {
valNum = parseFloat(valNum);
document.getElementById(“outputCelcius”).innerHTML=(valNum-32)/1.8;
}
</script>
</body>
#javascript #html5 #solidity #blockchain