I wanted the equation to take user input and give a response based on the output. The equation works just fine, I can't get it to print anything. For example the answer is 10 and it prints 10 along with a comment. Maybe its something I'm looking over, or my code could be horribly wrong. Help?
<html>
<body>
Total=3.21+9.63 x S //equation
<form id="function" onsubmit="return false" oninput="o.value = 3.21 + (9.63 *parseInt(c.value))">
=3.21+(9.63 *
<input name="c" type="number" step="any">) =
<output name="o"> </output>
<input type="button" value="Predict" name="myButton" onClick="myMath()"> </form>
<div id="mys1"></div>
<script language="JavaScript">
//my concept
function myMath() {
if (((document.function.o.output) < -30))
document.getElementById("mys1").innerHTML = 'That'
s a little cold!';
}
</script>
</body>
</html>
This bit is invalid javascript:
It should look like this:
To avoid the missing
'
which should be causing an error in the web console.