Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Kalkulator - JS</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- </head>
- <body>
- <input type="text" id="ekran" readonly="readonly"/>
- <input type="text" id="prviBroj" hidden="hidden"/>
- <input type="text" id="operand" hidden="hidden"/>
- <br />
- <input type="button" value="7" onclick="dodajBroj(7)"/>
- <input type="button" value="8" onclick="dodajBroj(8)"/>
- <input type="button" value="9" onclick="dodajBroj(9)"/>
- <input type="button" value="+" onclick="operacija('+')"/>
- <br />
- <input type="button" value="4" onclick="dodajBroj(4)"/>
- <input type="button" value="5" onclick="dodajBroj(5)"/>
- <input type="button" value="6" onclick="dodajBroj(6)"/>
- <input type="button" value="-" onclick="operacija('-')"/>
- <br />
- <input type="button" value="1" onclick="dodajBroj(1)"/>
- <input type="button" value="2" onclick="dodajBroj(2)"/>
- <input type="button" value="3" onclick="dodajBroj(3)"/>
- <input type="button" value="*" onclick="operacija('*')"/>
- <br />
- <input type="button" value="0" onclick="dodajBroj(0)"/>
- <input type="button" value="C"/>
- <input type="button" value="="/>
- <input type="button" value="/" onclick="operacija('/')"/>
- <script>
- function dodajBroj(broj){
- document.getElementById("ekran").value += broj;
- }
- function operacija(operand){
- document.getElementById('prviBroj').value= document.getElementById('ekran').value;
- document.getElementById('operand').value=operand;
- document.getElementById('ekran').value="";
- }
- function izracunaj
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement