Dynamically Creating a Div in Javascript
Hey, it's handy OK?
var newdiv = document.createElement('div');
newdiv.setAttribute('id','DivName');
newdiv.style.width = 300;
newdiv.style.height = 300;
newdiv.style.left = 300;
newdiv.style.top = 300;
newdiv.style.position = "absolute";
newdiv.style.background = "#00C";
newdiv.style.border = "4px solid #000";
newdiv.innerHTML = 'text';
document.body.appendChild(newdiv);
0 Comments:
Posta un commento
<< Home