a guest Oct 21st, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <body>
  3.     <input type="text" id="v1">
  4.     <input type="text" id="v2">
  5.     <input type="text" id="v3">
  6.     <input type="text" id="v4">
  7.     <input type ="button" onclick="average()"value="average">
  8.     <input type="text" id ="avg">
  9.     <script type"text/javascript">
  10.     function average(){
  11.         var a=parseInt(document.getElementById("v1").value);
  12.         var b=parseInt(document.getElementById("v2").value);
  13.         var c=parseInt(document.getElementById("v3").value);
  14.         var d=parseInt(document.getElementById("v4").value);
  15.         var afinal=((a+b+c+d)/4);
  16.             document.getElementById('avg').value=afinal;
  17.         }
  18.     </script>  
  19.     </body>
  20. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand