Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <head>
  3. <title>Kalkulator</title>
  4. <meta charset="utf-8">
  5. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  6.  
  7. <script type="text/javascript">
  8. $(document).ready(function(){
  9. $('#policz').on('click', function(){
  10. var liczba = $('#liczba').val();
  11. var wynik = Math.ceil((liczba/0.7) * 2);
  12. if(wynik % 2 === 0 ){
  13. $('#wynik').val(wynik);
  14. }else{
  15. wynik++;
  16. $('#wynik').val(wynik);
  17. }
  18. });
  19. });
  20. </script>
  21. </head>
  22. <body>
  23. <h1>kalkulator</h1>
  24.  
  25. <input type="text" id="liczba">
  26. <input type="text" id="wynik">
  27. <button id="policz">Policz</button>
  28.  
  29.  
  30. </body>
  31. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement