Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.82 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <body>
  4. <div id="contentBody">
  5. <h1 id="heading" align="center">
  6. Website style Editor
  7. </h1>
  8. <p id= "paragraph">
  9. Lorem ipsum dolor sit amet, habemus officiis mandamus id cum, tota harum persius ius ad, quo epicuri explicari ex. Omnesque atomorum periculis usu et, no audiam lobortis sed, vim ad iisque dignissim efficiendi. Nam id legimus molestie noluisse. Vivendum erroribus consulatu duo cu, delectus ocurreret ius ei.
  10.  
  11. Ut sed autem tollit offendit. Atqui quidam eu qui. Ea libris graeci iisque est, graece virtute te vim, vel ad appetere tacimates concludaturque. Oblique ullamcorper ut pri, pro ad suas denique appareat. Commune pericula philosophia vis at, usu percipit invidunt voluptaria in. Elitr liberavisse mel eu.
  12.  
  13. Quas quaestio theophrastus ne ius. Eum ex eius animal mediocrem, an nec movet clita scribentur. Eu vim nonumes ponderum legendos, ei cum putent percipit concludaturque, eos mucius facete id. Nobis scribentur ius in. Homero facilisis vis an, esse expetenda splendide eu eum, ei his dicit eligendi scripserit.
  14. </p>
  15. <form id = "form1">
  16. <input type="text" id="color" placeholder="Type a color" size="50">
  17. <button type="button" id="buttons" onclick="changeColor()"> Change color </button> <br/>
  18. <input type="text" id="bckgrnd" placeholder="Type a background color" size="50">
  19. <button type="button" id="buttons" onclick="changeBackground()"> Change Background </button> <br/>
  20. <input type="text" id="style" placeholder="Type a font style" size="50">
  21. <button type="button" id="buttons" onclick="changeFont()"> Change Font Family </button> <br/>
  22. <input type="text" id="size" placeholder="Type a font size" size="50">
  23. <button type="button" id="buttons" onclick="changeSize()"> Change text size </button> <br/>
  24. </form><br/>
  25. <b>Change the size of the heading by moving this slider: </b> <br/>
  26. <label>Heading Size: </lable><input type="range" min="10" max="80" step="10" value="30" onchange="headingSize(this.value)">
  27. </div>
  28.  
  29. <script>
  30. function changeColor() {
  31. var choiceColor = document.getElementById("color");
  32. var paragraph = document.getElementById("paragraph");
  33.  
  34. if (paragraph!=null) {
  35. paragraph.style.color = choiceColor.value;
  36. }
  37. }
  38.  
  39. function changeBackground() {
  40. var choiceBgColor = document.getElementById("bckgrnd");
  41. var paragraph = document.getElementById("paragraph");
  42.  
  43. if (paragraph!=null) {
  44. paragraph.style.backgroundColor = choiceBgColor.value;
  45.  
  46. }
  47. }
  48.  
  49. function changeFont() {
  50. var choiceFontFam = document.getElementById("style");
  51. var paragraph = document.getElementById("paragraph");
  52.  
  53. if (paragraph!=null) {
  54. paragraph.style.fontFamily = choiceFontFam.value;
  55.  
  56. }
  57. }
  58.  
  59. function changeSize() {
  60. var choiceFontSize = document.getElementById("size");
  61. var paragraph = document.getElementById("paragraph");
  62.  
  63. if (paragraph!=null) {
  64. paragraph.style.fontSize = choiceFontSize.value + "px";
  65.  
  66. }
  67. }
  68.  
  69. function headingSize(valChoiceFontSize) {
  70.  
  71. var paragraph = document.getElementById("heading");
  72.  
  73. if (paragraph!=null) {
  74. paragraph.style.fontSize = valChoiceFontSize + "px";
  75.  
  76. }
  77. }
  78.  
  79.  
  80. </script>
  81.  
  82. <style>
  83. body{
  84. background-color: lightblue;
  85. }
  86. #contentBody{
  87. background-color: white;
  88. border: 1px solid block;
  89. padding: 10px;
  90. border-radius: 5px;
  91. margin: 100px;
  92.  
  93. }
  94. #form1{
  95.  
  96. }
  97. #buttons{
  98. font-family: sans-serif;
  99. font-size: 10px;
  100. background-color: rgb(34, 153, 34);
  101. color: #fff;
  102. border: 0px;
  103. border-radius: 3px;
  104. padding: 10px;
  105. cursor: pointer;
  106. margin-bottom: 10px;
  107. text-align: center;
  108. width: 250px;
  109. }
  110. #buttons:hover{
  111. background-color: rgb(51, 170, 105);
  112. }
  113. </style>
  114.  
  115. </div>
  116. </body>
  117. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement