Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pl">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Kalkulator</title>
- <link rel="stylesheet" href="style.css">
- </head>
- <body>
- <div class="calculator">
- <input type="number" id="input1"/> <input type="number" id="input2"/><br/>
- <div class="buttons">
- <button id="dodawanie" onclick="suma()">Dodawanie</button>
- <button id="odejmowanie">Odejmowanie</button>
- <button id="mnozenie">Mnożenie</button>
- <button id="dzielenie">Dzielenie</button>
- </div>
- </div>
- <script>
- const dodawanie = document.getElementById("dodawanie");
- const odejmowanie = document.getElementById("odejmowanie");
- const mnozenie = document.getElementById("mnozenie");
- const dzielenie = document.getElementById("dzielenie");
- function suma(){
- const inputA = parseFloat(document.getElementById("input1").value);
- const inputB = parseFloat(document.getElementById("input2").value);
- alert(inputA + inputB);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement