Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <html>
  2. <head>
  3. <style>
  4. .tlo{
  5. position: relative;
  6. width: 320px;
  7. height: 250px;
  8. border: 3px solid black;
  9. background: linear-gradient(to right, #11aaff, white);
  10. }
  11. .napis1{
  12. position: absolute;
  13. left: 20px;
  14. top: 20px;
  15. }
  16. .napis2{
  17. position: absolute;
  18. left: 20px;
  19. top: 75px;
  20. }
  21. .input1{
  22. position: absolute;
  23. left: 120px;
  24. top: 18px;
  25. border: 1px solid black;
  26. }
  27. .input2{
  28. position: absolute;
  29. left: 120px;
  30. top: 72px;
  31. border: 1px solid black;
  32. }
  33. .oblicz{
  34. position: absolute;
  35. left: 135px;
  36. top: 120px;
  37. border: 1px solid black;
  38. }
  39. .w{
  40. position: absolute;
  41. left: 140px;
  42. top: 165px;
  43.  
  44. }
  45. .kwadrat{
  46. position: absolute;
  47. left: 120px;
  48. top: 160px;
  49. width: 80px;
  50. height: 60px;
  51. border: 1px solid black;
  52. background-color: red;
  53. }
  54. </style>
  55. </head>
  56. <body>
  57. <pre>
  58. <script>
  59. function funkcja(){
  60. var a=parseFloat(document.getElementById("o1").value)
  61. var b=parseFloat(document.getElementById("o2").value)
  62. //wykladnik 0
  63. if(b==0){
  64. ww=1
  65. }
  66. //wykladnik >0
  67. else if(b>0){
  68. ww=1
  69. for(c=1;c<=b;c++){
  70. ww=ww*a
  71. }
  72. }
  73. //wykladnik <0
  74. else if(b<0){
  75. wy=1
  76. for(c=1;c<=b;c++){
  77. wy=wy*a
  78. ww=1/ww
  79. }
  80. }
  81.  
  82. paragraf=document.getElementById("wynik")
  83. paragraf.innerHTML=ww
  84. }
  85. </script>
  86. </pre>
  87.  
  88. <div class="tlo">
  89.  
  90. <!-- formularz -->
  91. <form name="formularz">
  92.  
  93. <div class="napis1">
  94. Podstawa:
  95. </div>
  96.  
  97. <div class="input1">
  98. <input type="text" id="o1"/><br>
  99. </div>
  100.  
  101. <div class="napis2">
  102. Wykładnik:
  103. </div>
  104.  
  105. <div class="input2">
  106. <input type="text" id="o2"/>
  107. </div>
  108. <div class="oblicz">
  109. <input type="button" value="Oblicz" onClick="funkcja()"/>
  110. </div>
  111.  
  112. </form>
  113.  
  114. <div class="kwadrat">
  115. </div>
  116. <p class="w" id="wynik"></p>
  117. </div>
  118.  
  119.  
  120. </body>
  121. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement