Advertisement
tei123

asd

Nov 29th, 2016
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <html>
  2. <body bgcolor="blue" name="kolor" >
  3.  
  4. <input type=text id="l1"/>
  5. <input type=text id="l2"/>
  6. <input type=text id="l3"/>
  7. <br>
  8. <button onClick="silnia()"> SILNIA </button>
  9. &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
  10. <button onClick="iloczyn()"> ILOCZYN PARZYSTYCH </button>
  11. &nbsp
  12. <button onClick="wyswietl()"> WYSWIETL </button>
  13.  
  14. <script>
  15.  
  16.  
  17.  
  18. function silnia()
  19. {
  20. var wynik=1;;
  21. var lib = parseInt(document.getElementById("l1").value);
  22.  
  23. for (lib;lib>0;lib--)
  24.  
  25. while (lib > 0 )
  26. {
  27. wynik = wynik * lib;
  28. lib = lib - 1;
  29. }
  30.  
  31. alert (wynik)
  32. };
  33.  
  34. function iloczyn()
  35. {
  36. var a = parseInt(document.getElementById("l1").value);
  37. var b = parseInt(document.getElementById("l2").value);
  38. var c = parseInt(document.getElementById("l3").value);
  39.  
  40. var ap=1;
  41. var bp=1;
  42. var cp=1;
  43. if (a%2==0)
  44. ap=a;
  45. if (b%2==0)
  46. bp=b;
  47. if (c%2==0)
  48. cp=c;
  49.  
  50. alert(ap*bp*cp);
  51.  
  52. };
  53.  
  54. function wyswietl()
  55. {
  56. var a = parseInt(document.getElementById("l1").value);
  57. var b = parseInt(document.getElementById("l2").value);
  58.  
  59. if (b>30)
  60. {
  61. b=30;
  62. };
  63.  
  64. for (a;a<=b;a++)
  65. {
  66. document.write(a)+" ";
  67. }
  68.  
  69. };
  70.  
  71. </script>
  72. </body>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement