It depends upon when you want to do that. If it's as the document is loading, then you probably want the document.write() method. If it's after the page is loaded, you want to either use the innerHTML property of an existing element or use DOM level 2 methods to create and insert your division. If it's empty to begin with, there's probably no harm in having it already on the page, this will save considerable coding. That way all you need to do is fill it.
But the short answer is:
Code:
var myDiv = document.createElement('div');
myDiv.id = 'showDiv';
document.body.appendChild(myDiv);
That last line can have many variations depending upon just where you want to put the new division.
Bookmarks