Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. //Zadanie 5
  2.  
  3. <html>
  4. <head>
  5. <title>Zmiana kolorów</title>
  6.  
  7. </head>
  8. <body>
  9. <h1>Wprowadź ciąg znaków</h1>
  10. <input id='inp'>
  11. <button id='but' onclick='wprowadz()'>
  12. Zaakceptuj
  13. </button>
  14. <h1 id='tekst'>
  15. </h1>
  16. <script type='text/javascript'>
  17. function wprowadz(){
  18. var tekst = document.getElementById('inp').value;
  19. var tekst2 = "";
  20. for(var i=0;i<tekst.length;i++)
  21. {
  22. var color = '#'+Math.ceil(Math.random()*9999);
  23. tekst2 += tekst[i].fontcolor(color);
  24. document.getElementById('tekst').innerHTML = tekst2;
  25. }
  26. setInterval(wprowadz(),1000);
  27. }
  28. </script>
  29. </body>
  30. </html>
  31.  
  32. //Zadanie 6
  33.  
  34.  
  35. <html>
  36. <head>
  37. <title>JavaScript animation</title>
  38. <style>
  39. #square{
  40. width : 100px;
  41. height : 100px;
  42. background-color : #333;
  43. position: absolute;
  44. left : 0px;
  45. top : 100px;
  46. }
  47. </style>
  48. <script type='text/javascript'>
  49. function move(){
  50. setInterval(move,1000);
  51. document.write("A");
  52. var x = document.getElementById('square').offsetLeft;
  53. document.getElementById('square').style.left = x+10+'px';
  54. }
  55. </script>
  56. </head>
  57. <body>
  58. <div id='square' oclick = "move()"></div>
  59. </body>
  60. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement