Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title> Skrypty ~ MZ </title>
- <meta charset="UTF-8">
- <script type="text/javascript">
- function nwd()
- {
- var a=parseInt(document.getElementById('a').value);
- var b=parseInt(document.getElementById('b').value);
- console.log(a);
- console.log(b);
- while(a!=b)
- {
- if(a>b)
- a=a-b;
- else
- b=b-a;
- }
- alert('NWD: '+a);
- }
- function color()
- {
- var color=prompt("Podaj kolor!","deepskyblue");
- document.bgColor=color;
- }
- </script>
- </head>
- <body>
- Podaj pierwszą liczbę<br>
- <input id="a"><br>
- Podaj drugą liczbę<br>
- <input id="b"><br>
- <button onclick="nwd()">Wykonaj NWD!</button>
- <button onclick="color()">Zmień kolor!</button>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement