Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //this is the javascript
- function stopDesc(){
- var divElement = document.createElement("Div");
- divElement.id = "divID";
- // Styling it
- divElement.style.textAlign = "center";
- divElement.style.fontWeight = "bold";
- divElement.style.fontSize = "smaller";
- //divElement.style.marginTop = "100px";
- divElement.style.paddingTop = "100px";
- divElement.style.width = "500px";
- divElement.style.height = "250px";
- divElement.style.background = "orange";
- divElement.style.margin="0 auto";
- divElement.style.color = "white";
- divElement.style.position="relative";
- divElement.style.zIndex="1000";
- // Adding a paragraph
- var paragraph = document.createElement("P");
- var text =
- document.createTextNode("Text..................................");
- paragraph.appendChild(text);
- divElement.appendChild(paragraph);
- // Adding a button
- var button = document.createElement("Button");
- var textForButton = document.createTextNode("Next->");
- button.appendChild(textForButton);
- button.addEventListener("click", function(){
- alert("Hi!");
- });
- divElement.appendChild(button);
- // Appending the div element to body
- document.getElementsByTagName("body")[0].appendChild(divElement);
- //document.getElementById("divID").setAttribute('align','center');
- }
- divElement.style.marginTop = "50px";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement