Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <html>
  2. <head>
  3. <style>
  4. .tlo{
  5. position: relative;
  6. width: 400px;
  7. height: 300px;
  8. border: 2px solid black;
  9. border-radius: 5px;
  10. }
  11. .napis{
  12. position: absolute;
  13. top: 2px;
  14. left: 70px;
  15. text-align: center;
  16. font-size: 50px;
  17. }
  18. .zmien{
  19. position: absolute;
  20. top: 250px;
  21. left: 165px;
  22. border: 1px solid black;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <pre>
  28. <script>
  29. function klik(){
  30. r=Math.floor(Math.random()*256)
  31. g=Math.floor(Math.random()*256)
  32. b=Math.floor(Math.random()*256)
  33. s=Math.floor(Math.random()*50)+10
  34. var p=document.getElementById("inapis")
  35. var att=document.createAttribute("style")
  36. att.value="color: rgb("+r+", "+g+", "+b+"); font-size: "+s+";"
  37. p.setAttributeNode(att)
  38. }
  39. </script>
  40. </pre>
  41. <form name="formularz">
  42. <div class="tlo">
  43. <p id="inapis" class="napis">NAPIS Z <br>LOSOWYM<br> STYLEM</p>
  44. <input type="button" value="ZMIEŃ" class="zmien" onClick="klik()"/>
  45. </div>
  46. </form>
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement