Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <style>
- body {
- margin:0px;
- }
- .temperatura {
- width: 100%;
- height: 60px;
- text-align:center;
- background-color: aqua;
- }
- .lewy {
- width: 30%;
- height: 400px;
- background-color: grey;
- float:left;
- }
- .prawy {
- width:70%;
- height: 400px;
- background-color: coral;
- float:left;
- }
- </style>
- </head>
- <body>
- <div class = "temperatura">
- <h1>TEMPERATURA</h1>
- </div>
- <div class = "lewy">
- <form>
- Podaj Temperature w stopniach celcjusza <input type = "text" id ="celc"><br>
- Podaj Temperature w stopniach kelwina: <input type = "text" id ="kelw"><br><br>
- <input type = "reset" value = "przelicz" onclick = "stopnie()">
- </form>
- </div>
- <div class = "prawy">
- <p id = "wynik"></p>
- </div>
- <script>
- function stopnie(){
- var celc = document.getElementById("celc").value;
- var kelw = document.getElementById("kelw").value;
- if ((kelw == "") && (celc == "")){
- alert("oba puste");
- }
- if ((kelw != "") && (celc != "")){
- alert("oba pelne")
- }
- if(celc == "" && kelw != "") {
- var wynik1 = (kelw - 32) / 1.8;
- var element1 = document.getElementById("wynik").innerHTML = kelw+" farenhajtow "+" to "+wynik1+" stopni celcjusza ";
- }
- if (kelw == "" && celc != ""){
- var wynik = celc * 1.8 + 32;
- var element = document.getElementById("wynik").innerHTML = celc+" stopni celcjusza "+" to "+wynik+" farenhajtow ";
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement