title: One output from multiple inputs in javascript
body: <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en" dir="ltr"&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;JavaScript Multiple inputs&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
  
      &lt;div class=""&gt;
  
        &lt;input type="number" max="5" min="1" name="input1" value="0" placeholder="0"&gt;&lt;br&gt;
        &lt;input type="number" max="5" min="1" name="input2" value="0" placeholder="0"&gt;&lt;br&gt;
        &lt;button type="button" name="button" onclick="calculate()"&gt;test&lt;/button&gt;&lt;br&gt;
        &lt;span id="output"&gt; output is &lt;/span&gt;
      &lt;/div&gt;
  
      &lt;script type="text/javascript"&gt;
        function calculate() {
          var input1 = getElementsByName('input1').value ;
          var input2 = getElementsByName('input2').value ;
  
          getElementsById('output').innerHTML = (2*input1) + (input2/2) ;
        }
      &lt;/script&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I want to make an output based on multiple outputs. In this script, I want to make some calculations of the inputs of the user. However, every time I try to run the code the output does not show any result (I am a beginner).</p>