Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- Valoare 1: <input type="text" id="v1"><br><br>
- Valoare 2: <input type="text" id="v2"><br><br>
- Valoare 3: <input type="text" id="v3"><br><br>
- Valoare 4: <input type="text" id="v4"><br><br>
- <br>
- <input type ="button" onclick="average()"value="Calculeaza Media"><br><br>
- Media este: <input type="text" id ="avg">
- <script type"text/javascript">
- function average(){
- var a=parseInt(document.getElementById("v1").value);
- var b=parseInt(document.getElementById("v2").value);
- var c=parseInt(document.getElementById("v3").value);
- var d=parseInt(document.getElementById("v4").value);
- var afinal=((a+b+c+d)/4);
- document.getElementById('avg').value=afinal;
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement