Guest User

Untitled

a guest
Jan 18th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>JavaScript and HTML</title>
  5. <meta charset="utf-8"/>
  6. <script>
  7. function changeTitleCSSStyle() {
  8. var title = document.querySelector("#mainTitle");
  9. title.style.color = 'black';
  10. title.style.backgroundColor = "yellow";
  11. title.style.border = "5px dashed red";
  12. }
  13. </script>
  14. <style id="jsbin-css">
  15. h1 {
  16. color:red;
  17. background-color:lightGreen;
  18. border:12px solid violet;
  19. padding: 5px;
  20. border-radius: 15px;
  21. text-align: center;
  22. }
  23.  
  24. p, h1 {
  25. font-family: cursive
  26. }
  27.  
  28. p, img, button {
  29. margin-left:50px;
  30. }
  31. </style>
  32. </head>
  33. <body>
  34. <h1 id="mainTitle">My home page</h1>
  35.  
  36. <p>This is an example of interactivity between JavaScript and the HTML content of a document.</p>
  37. <button onclick="changeTitleCSSStyle();">Click me to change the CSS colors of the title of the page</button>
  38. <script id="jsbin-javascript">
  39. var video;
  40.  
  41. function init() {
  42. // function called when the page is loaded
  43.  
  44. video = document.querySelector("#myVideo");
  45.  
  46. // For initial value
  47. video.width = window.innerWidth;
  48. video.height = window.innerHeight;
  49.  
  50. // For dealing with window resize
  51. window.onresize = function() {
  52. video.width = window.innerWidth;
  53. video.height = window.innerHeight;
  54. };
  55.  
  56. }
  57. </script>
  58.  
  59.  
  60. <script id="jsbin-source-css" type="text/css">h1 {
  61. color:red;
  62. background-color:lightGreen;
  63. border:12px solid violet;
  64. padding: 5px;
  65. border-radius: 15px;
  66. text-align: center;
  67. }
  68.  
  69. p, h1 {
  70. font-family: cursive
  71. }
  72.  
  73. p, img, button {
  74. margin-left:50px;
  75. }</script>
  76.  
  77. <script id="jsbin-source-javascript" type="text/javascript">var video;
  78.  
  79. function init() {
  80. // function called when the page is loaded
  81.  
  82. video = document.querySelector("#myVideo");
  83.  
  84. // For initial value
  85. video.width = window.innerWidth;
  86. video.height = window.innerHeight;
  87.  
  88. // For dealing with window resize
  89. window.onresize = function() {
  90. video.width = window.innerWidth;
  91. video.height = window.innerHeight;
  92. };
  93.  
  94. }</script></body>
  95. </html>
Add Comment
Please, Sign In to add comment