title: Finding Percentage of marks in Javascript
body: <p>I am trying to get percentage of marks submitted in form. But I am unable to understand what I am doing wrong in my code. I am taking marks from students and displaying their name and percentage. I am using form and input and submitting it to get the percentage in javascript.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function getReport() {
      var name = document.forum.getElementById('name1').value;
      var eng = document.forum.getElementById('eng').value;
      var mat = document.forum.getElementById('mathss').value;
      var phy = document.forum.getElementById('physs').value;
  
      var totalmarks = eng + mat + phy;
  
      var percentage = (totalmarks / 3) * 100;
  
      document.getElementById('resname').innerHTML = name;
      document.getElementById('getavg').innerHTML = percentage;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt; Student Result &lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt; Student Result &lt;/h1&gt;
          &lt;form name="forum" onSubmit="getReport()"&gt;
              &lt;table&gt;
                  &lt;tr&gt;
                      &lt;td&gt; Name:  &lt;input type="text" id="name1" &gt; &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt; &lt;strong&gt; Marks &lt;/strong&gt; &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt; English  &lt;input type="text" id="eng" &gt; &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt; Maths  &lt;input type="text" id="mathss" &gt; &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt; Physics  &lt;input type="text" id="physs" &gt; &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt; &lt;input type="submit" id="subb"  value="SUBMIT"&gt; &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/form&gt;
          &lt;p id="resname"&gt;&lt;/p&gt;
          &lt;p id="getavg"&gt;&lt;/p&gt;
          &lt;script language="javascript" src="res.js" &gt;  &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>