-2

I just finished an algebra course in high school, and decided to create a program that would take 3 values and do some calculations to give me a z-value. However, when trying to gather the information, I keep getting an error saying that it cannot read property 'value' of null. I've looked through this site, but couldn't implement a fix. Right now the code is just supposed to console.log the values put in, along with the z-score, determined by an equation in the code.

// z = (x-μ)/σ
    var textboxD;
    var textboxM;
    var textboxS;
  var zScore;

    function calculateZ() {

        var textboxD = document.getElementById("stardardD").value
        var textboxM = document.getElementById("mean").value
        var textboxS = document.getElementById("score").value

        var zScore = (textboxS - textboxM) / textboxD

        console.log(textboxD + ", " + textboxM + ", " + textboxS + ", " + zScore);

    }
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <input id="standardD"type="text"/>
  σ
  <input id="mean"type="text"/>
  μ
  <input id="score"type="text"/>
  score
  <br>
  <button onClick="calculateZ()">
  CALCULATE
  </button>
</body>
</html>

0 Answers0