title: Javascript, innerHTML and getElementById
body: <p>I'm completely new to javascript and a friend helped me with a problem, I know what it does but I can't really understand some parts, I've made some comments in the code with some questions I hope you can answer them.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Uppgift 15&lt;/title&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
          &lt;script&gt;
              var  resultat = 0;
  
              function addera(){
  
                  var t1 = Math.round(object("t1").value);
  
                  if (t1 != 0){
                      resultat += t1;
                      object("t1").value = ""; 
                  }
                  else{
                      object("resultat").innerHTML = resultat; // where does "object" come from, what does innerHTML do?
                  }
              }
  
              function object(id){ // i dont get this at all what does this do is there any other way to return?
                  return document.getElementById(id);
              }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form&gt;
          &lt;input id="t1"&gt;
          &lt;input type="button" onClick=addera() value="resultat"&gt;
          &lt;p id="resultat"&gt;&lt;/p&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>