Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <meta charset="UTF-8">
- <style>
- #square{
- width: 300px;
- height: 300px;
- background-color: gray;
- border: 1px solid black;
- margin-left: 30px;
- }
- #form{
- margin-top: 40px;
- }
- input[type=button]{
- display:block;
- margin-top: 30px;
- margin-left: 30px;
- }
- </style>
- <script type="text/javascript">
- function ustawKolor()
- {
- kwadrat = document.getElementById("square");
- wartosc = Math.random()*100;
- kwadrat.style.backgroundColor="rgb("+wartosc+"%,"+wartosc+"%,"+wartosc+"%)";
- }
- </script>
- </head>
- <body>
- <div id="square"></div>
- <form id="form">
- <input type="button" value="Ustaw Kolor" onclick="ustawKolor()"/>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement