Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.  
  3. <head>
  4. <title> Skrypty ~ MZ </title>
  5. <meta charset="UTF-8">
  6. <script type="text/javascript">
  7. function nwd()
  8. {
  9. var a=parseInt(document.getElementById('a').value);
  10. var b=parseInt(document.getElementById('b').value);
  11. console.log(a);
  12. console.log(b);
  13.   while(a!=b)
  14.   {
  15.   if(a>b)
  16.   a=a-b;
  17.   else
  18.   b=b-a;
  19.   }
  20. alert('NWD: '+a);
  21. }
  22. function color()
  23. {
  24. var color=prompt("Podaj kolor!","deepskyblue");
  25. document.bgColor=color;
  26. }
  27. </script>
  28. </head>
  29.  
  30. <body>
  31. Podaj pierwszą liczbę<br>
  32. <input id="a"><br>
  33. Podaj drugą liczbę<br>
  34. <input id="b"><br>
  35. <button onclick="nwd()">Wykonaj NWD!</button>
  36. <button onclick="color()">Zmień kolor!</button>
  37. </body>
  38.  
  39. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement