SHARE
TWEET

Untitled

a guest Jul 19th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //this is the javascript
  2.  
  3. function stopDesc(){
  4. var divElement = document.createElement("Div");
  5. divElement.id = "divID";
  6.  
  7. // Styling it
  8. divElement.style.textAlign = "center";
  9. divElement.style.fontWeight = "bold";
  10. divElement.style.fontSize = "smaller";
  11. //divElement.style.marginTop = "100px";
  12. divElement.style.paddingTop = "100px";
  13. divElement.style.width = "500px";
  14. divElement.style.height = "250px";
  15. divElement.style.background = "orange";
  16. divElement.style.margin="0 auto";
  17. divElement.style.color = "white";
  18. divElement.style.position="relative";
  19. divElement.style.zIndex="1000";
  20.  
  21. // Adding a paragraph
  22. var paragraph = document.createElement("P");
  23. var text =
  24. document.createTextNode("Text..................................");
  25. paragraph.appendChild(text);
  26. divElement.appendChild(paragraph);
  27.  
  28. // Adding a button
  29. var button = document.createElement("Button");
  30. var textForButton = document.createTextNode("Next->");
  31. button.appendChild(textForButton);
  32. button.addEventListener("click", function(){
  33.   alert("Hi!");
  34. });
  35. divElement.appendChild(button);
  36.  
  37. // Appending the div element to body
  38. document.getElementsByTagName("body")[0].appendChild(divElement);
  39. //document.getElementById("divID").setAttribute('align','center');
  40. }
  41.      
  42. divElement.style.marginTop = "50px";
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top