Last active
August 29, 2015 14:05
-
-
Save benglewis/13805ba270c5ef67e0e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var newDiv = document.createElement("div"); | |
var newContent = document.createTextNode("Hi there and greetings!"); | |
newDiv.style.textAlign = "center"; | |
newDiv.style.position = "absolute"; | |
newDiv.style.height = "50px"; | |
newDiv.style.width = "500px"; | |
newDiv.style.top = "50%"; | |
newDiv.style.left = "50%"; | |
newDiv.style.marginTop = "-25px"; | |
newDiv.style.marginLeft = "-250px"; | |
newDiv.style.backgroundColor = "#aaa"; | |
newDiv.style.border = "1px solid #777"; | |
newDiv.style.zIndex = "100"; | |
newDiv.appendChild(newContent); //add the text node to the newly created div. | |
var newButton = document.createElement("button"); | |
newButton.innerHTML = "OK"; | |
newButton.onclick = "function() { document.removeChild(newDiv); }"; | |
newDiv.appendChild(newButton); | |
document.getElementsByTagName('html')[0].appendChild(newDiv); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment