If you want it to do in Javascript then use
createElement()
have a look on the example
function addDiv(innertext)
{
var r = document.createElement('Div');
r.style.height="20px";
r.style.width="25px";
r.appendChild(innertext);
}
this will add a div on the page. If you want to add this in a specific control then use can use
document.getElementById('specific control name').createElement('Div');