title: How do i display button value in a text field in JavaScript(not JQuery)
body: <p>i have made a simple calculator and i am unable to print the value of my buttons on click onto the text field. How do i do that? I want to use JavaScript only, not JQuery. When i click on my buttons the values are not displaying on the text field "scr". How can i implement that?</p>
  
  <p>here is my code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Calculator&lt;/title&gt;
  &lt;style&gt;
  
  &lt;/style&gt;
  &lt;script type="javascript"&gt;
  function display0()
  {
  a=document.all.f1.zero.value;
  document.all.getElementById("scr").innerHTML=a;
  
  b=document.all.f1.one.value;
  document.all.getElementById('scr').value=b;
  
  c=document.all.f1.two.value;
  document.all.getElementById("scr").innerHTML=c;
  
  d=document.all.f1.three.value;
  document.all.getElementById("scr").innerHTML=d;
  
  e=document.all.f1.four.value;
  document.all.getElementById("scr").innerHTML=e;
  
  f=document.all.f1.five.value;
  document.all.getElementById("scr").innerHTML=f;
  
  g=document.all.f1.six.value;
  document.all.getElementById("scr").innerHTML=g;
  
  h=document.all.f1.seven.value;
  document.all.getElementById("scr").innerHTML=h;
  
  i=document.all.f1.eight.value;
  document.all.getElementById("scr").innerHTML=i;
  
  j=document.all.f1.nine.value;
  document.all.getElementById("scr").innerHTML=j;
  
  k=document.all.f1.sum.value;
  document.all.getElementById("scr").innerHTML=k;
  
  l=document.all.f1.sub;
  document.all.getElementById("scr").innerHTML=l;
  
  m=document.all.f1.mul;
  document.all.getElementById("scr").innerHTML=m;
  
  n=document.all.f1.div;
  document.all.getElementById("scr").innerHTML=n;
  
  o=document.all.f1.clear;
  document.all.getElementById("scr").innerHTML=o;
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form name="f1" id="f1" method="post"&gt;
  &lt;div&gt;
  &lt;input type="text" id="scr" name="scr" /&gt;
  &lt;/div&gt;
  &lt;br/&gt;
  &lt;div&gt;
  &lt;input type="button" value="7" onclick="display7()" id="seven"name="seven"/&gt;
  &lt;input type="button" value="8" onclick="display8()" id="eight"name="eight"/&gt;
  &lt;input type="button" value="9" onclick="display9()" id="nine"name="nine"/&gt;
  &lt;input type="button" value="/" onclick="display/()" id="div"name="div"/&gt;
  &lt;br/&gt;
  &lt;input type="button" value="4" onclick="display4()" id="four"name="four"/&gt;
  &lt;input type="button" value="5" onclick="display5()" id="five"name="five"/&gt;
  &lt;input type="button" value="6" onclick="display6()" id="six"name="six"/&gt;
  &lt;input type="button" value="X" onclick="displayX()" id="mul"name="mul"/&gt;
  
  &lt;br/&gt;
  
  &lt;input type="button" value="1" onclick="display()" id="one" name="one" /&gt;
  &lt;input type="button" value="2" onclick="display2()" id="two"name="two"/&gt;
  &lt;input type="button" value="3" onclick="display3()" id="three"name="three"/&gt;
  &lt;input type="button" value="-" onclick="display-()" id="sub"name="sub"/&gt;
  
  &lt;br/&gt;
  
  &lt;input type="button" value="CLR" onclick="displayC()"/&gt;     
  &lt;input type="button" value="0" onclick="display0()" id="zero"name="zero"/&gt;
  &lt;input type="button" value="=" onclick="display=()" id="eq"name="eq"/&gt;
  &lt;input type="button" value="+" onclick="display+()" id="sum"name="sum"/&gt;
  &lt;/div&gt;
  &lt;br/&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>