Untitled
raw download clone
TEXT
views 16
,
size 1868 b
<HTML>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Laboratorium 3 </title>
<meta charset="utf-8">
</head>
<body>
<header>
  <h1> Kalkulator </h1>
  <script type="text/javascript">
function obliczenia()
{
l1=document.getElementById("liczba1").value;
l2=document.getElementById("liczba2").value;
w = document.getElementById("wybierz").value;
if(w == 1){
dzielenie=l1/l2;
document.getElementById("wynik").value = l1 + " " +"/" + " "+ l2 + " " + " = " + dzielenie;
w = 0;
w = document.getElementById("wybierz").value;
}
if(w == 2){
mnozenie=l1*l2;
document.getElementById("wynik").value = l1 + " " +"*" + " "+ l2 + " " + " = " + mnozenie;
w = 0;
w = document.getElementById("wybierz").value;
}
if(w == 3){
odejmowanie=l1-l2;
document.getElementById("wynik").value = l1 + " " +"-" + " "+ l2 + " " + " = " + odejmowanie;
w = 0;
w = document.getElementById("wybierz").value;
}
if(w == 4){
var a = parseInt(l1);
var b = parseInt(l2);
var suma= a+b;
document.getElementById("wynik").value = a + " " + "+" + " " + b + " " + " = " + suma;
w = 0;
w = document.getElementById("wybierz").value;
}
}
</script>

</header>

<section>
  <nav>
    <ul>
      <li><a href="index.html">Strona</a></li>
      <li><a href="podstrona1.html">Galeria</a></li>
      <li><a href="podstrona2.html">Kalkulator</a></li>
    </ul>
  </nav>
  <article>
    <input type="number" id="liczba1" >
	  <input type="number" id="liczba2" >
	  
<select id="wybierz">
      <option value="1">/</option>
      <option value="2">*</option>
      <option value="3">-</option>
      <option value="4">+</option>
      </select>
	  <input type="button" value="=" onClick="obliczenia()">


<input type="text" id="wynik" >


  </article>
</section>
<footer>
  <p>Created in 2020</p>
</footer>

</body>
</html>
close fullscreen
Login or Register to edit or fork this paste. It's free.