Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. <html>
  2. <head>
  3. <style>
  4. body {
  5. margin:0px;
  6. }
  7. .temperatura {
  8. width: 100%;
  9. height: 60px;
  10. text-align:center;
  11. background-color: aqua;
  12. }
  13. .lewy {
  14. width: 30%;
  15. height: 400px;
  16. background-color: grey;
  17. float:left;
  18. }
  19. .prawy {
  20. width:70%;
  21. height: 400px;
  22. background-color: coral;
  23. float:left;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <div class = "temperatura">
  29. <h1>TEMPERATURA</h1>
  30. </div>
  31. <div class = "lewy">
  32. <form>
  33. Podaj Temperature w stopniach celcjusza <input type = "text" id ="celc"><br>
  34. Podaj Temperature w stopniach kelwina: <input type = "text" id ="kelw"><br><br>
  35. <input type = "reset" value = "przelicz" onclick = "stopnie()">
  36. </form>
  37. </div>
  38. <div class = "prawy">
  39. <p id = "wynik"></p>
  40. </div>
  41. <script>
  42. function stopnie(){
  43. var celc = document.getElementById("celc").value;
  44. var kelw = document.getElementById("kelw").value;
  45. if ((kelw == "") && (celc == "")){
  46. alert("oba puste");
  47. }
  48. if ((kelw != "") && (celc != "")){
  49. alert("oba pelne")
  50. }
  51. if(celc == "" && kelw != "") {
  52. var wynik1 = (kelw - 32) / 1.8;
  53. var element1 = document.getElementById("wynik").innerHTML = kelw+" farenhajtow "+" to "+wynik1+" stopni celcjusza ";
  54. }
  55. if (kelw == "" && celc != ""){
  56. var wynik = celc * 1.8 + 32;
  57. var element = document.getElementById("wynik").innerHTML = celc+" stopni celcjusza "+" to "+wynik+" farenhajtow ";
  58. }
  59. }
  60. </script>
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement