Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Zadanie 5
- <html>
- <head>
- <title>Zmiana kolorów</title>
- </head>
- <body>
- <h1>Wprowadź ciąg znaków</h1>
- <input id='inp'>
- <button id='but' onclick='wprowadz()'>
- Zaakceptuj
- </button>
- <h1 id='tekst'>
- </h1>
- <script type='text/javascript'>
- function wprowadz(){
- var tekst = document.getElementById('inp').value;
- var tekst2 = "";
- for(var i=0;i<tekst.length;i++)
- {
- var color = '#'+Math.ceil(Math.random()*9999);
- tekst2 += tekst[i].fontcolor(color);
- document.getElementById('tekst').innerHTML = tekst2;
- }
- setInterval(wprowadz(),1000);
- }
- </script>
- </body>
- </html>
- //Zadanie 6
- <html>
- <head>
- <title>JavaScript animation</title>
- <style>
- #square{
- width : 100px;
- height : 100px;
- background-color : #333;
- position: absolute;
- left : 0px;
- top : 100px;
- }
- </style>
- <script type='text/javascript'>
- function move(){
- setInterval(move,1000);
- document.write("A");
- var x = document.getElementById('square').offsetLeft;
- document.getElementById('square').style.left = x+10+'px';
- }
- </script>
- </head>
- <body>
- <div id='square' oclick = "move()"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement