title: Why is window.onload function undefined?
body: <p>I have made a simple function and it is supposed to run on window.onload. But instead, I get that it is undefined. Can anyone help me understand why I get this error?</p>
  
  <p>The form id is kalkulator and the name of the inputs is liter and enheter</p>
  
  <p>The function I have written is</p>
  
  <pre><code>window.onload = function () {
      form.kalkulator.focus();
  };
  </code></pre>
  
  <p>I have also written this </p>
  
  <pre><code>form.kalkulator = function () {
      if (form.enheter.value == "") {
          form.liter.value = "";
      } else{
          convertLiter();
      };
  }
  
  function convertLiter() {
      console.log(form.liter.value / person.volum() * person.sukker_g())
      form.enheter.value = form.liter.value / person.volum();
  
  }
  function convertEnheter() {
      console.log(form.enheter.value * person.sukker_g())
      form.liter.value = form.enheter.value * person.volum();
  }
  </code></pre>