I'm not sure how to take 2 inputs and return another value. Also is there any way for me to be able to tell where my code is going wrong? I'm still trying to understand all the nuances of how HTML and Javascript work together. I'm currently reading through Eloquent javascript but i'm always looking for suggested resources.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Wilks</title>
<script type="text/javascript" src="wilks.js"></script>
</head>
<body>
<p>
<label for="bodyWeight">Weight:</label>
<input id="bodyWeight" type="number" placeholder="Pounds">
<label for="Big 3 Total">Big 3 Total:</label>
<input id="liftTotal" type="number" placeholder="800" >
<button onclick="wilksCalculator(bodyWeight, liftTotal)">Analyze</button>
</p>
<p>Wilks Coefficient: <span id="outputWilks"></span></p>
</body>
</html>
// wilks.js
var a =-216.0475144;
var b =16.2606339;
var c =-0.002388645;
var d =-0.00113732;
var e =7.01863E-06;
var f =-1.291E-08;
var x = document.getElementById("bodyWeight").value;
var inputTotal = document.getElementById("liftTotal").vaule;
//var outputWilks;
function wilksCalculator(bodyWeight, liftTotal) {
bodyWeight = x;
return (liftTotal * (500/((a+b*x)+(c(Math.pow(x,2)))+(d+(Math.pow(x,3)))+(e+(Math.pow(x,4)))+(f(Math.pow(x,5))))));
}
var wilks = document.getElementById("outputWilks").innerHTML;
if (wilks) {
wilks.onsubmit = function () {
this.wilks.value = wilksCalculator(this.bodyWeight.value,
this.liftTotal.value);
return false;
};
}
wilksCalculator();
.innerHTML) does not have anonsubmitproperty.