SHARE
TWEET

Untitled

a guest Oct 21st, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <body>
  3.     Valoare 1: <input type="text" id="v1"><br><br>
  4.     Valoare 2: <input type="text" id="v2"><br><br>
  5.     Valoare 3: <input type="text" id="v3"><br><br>
  6.     Valoare 4: <input type="text" id="v4"><br><br>
  7.     <br>
  8.     <input type ="button" onclick="average()"value="Calculeaza Media"><br><br>
  9.     Media este: <input type="text" id ="avg">
  10.     <script type"text/javascript">
  11.     function average(){
  12.         var a=parseInt(document.getElementById("v1").value);
  13.         var b=parseInt(document.getElementById("v2").value);
  14.         var c=parseInt(document.getElementById("v3").value);
  15.         var d=parseInt(document.getElementById("v4").value);
  16.         var afinal=((a+b+c+d)/4);
  17.             document.getElementById('avg').value=afinal;
  18.         }
  19.     </script>  
  20.     </body>
  21. </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
 
Top