!function(){ //Create the element using the createElement method. var myDiv = document.createElement("div"); myDiv.id = 'dfClusterHostingStatus'; myDiv.style= 'width:100%;background:#CC0000;text-align:center;z-index:100;position:absolute;display:block;left:0;top:0;color:white;font-weight: bold;font-size:14px;'; myDiv.innerHTML = ''; //Finally, append the element to the HTML body document.body.insertBefore(myDiv, document.body.firstChild); }();