Código HTML :
<!DOCTYPE html> <html id="ihtml"> <head id=ihead><meta charset="utf-8"> <title>cristalab</title> </head> <body id='ibody'> </body> <script>
Dentro de las etiquetas javascript puede ir
Código Javascript :
function gebi(i){return document.getElementById(i);}
function obj(i,t,p){var n=document.createElement(t);n.id=i;gebi(p).appendChild(n);}
//esta es la funcion
function cen(i){
var o=gebi(i);
var ow=o.offsetWidth+'px';
o.style.width=ow;
o.style.position="relative";
o.style.display='block';
o.style.marginLeft='auto';
o.style.marginRight='auto';
}
obj('L000','div','ibody');
gebi('L000').innerHTML='hola mundo';
