<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Documento sin título</title> </head> <script language="javascript"> function reemplazar(textarea){ if(typeof textarea == 'string') textarea = document.getElementById(textarea); //Obtenemos el elemento textarea var div= document.createElement('div'); //Creamos un div sin nada div.style.width = textarea.offsetWidth+'px'; //Ajustamos la anchura div.style.height = textarea.offsetHeight+'px'; //Ajustamos la altura div.style.border = '1px solid red'; //Solo para poder verlo.. textarea.parentNode.replaceChild(div,textarea); //Reemplazamos el textarea }; </script> <body> <textarea id="tes" name="texto" cols="50" rows="20"></textarea> <input name="Boton" type="button" value="Boton" onclick="reemplazar('tes');"/> </body> </html>