Guarda questo esempio,adesso con html5 puoi scrivere anche dentro i div .
Ho un div dove puoi scrivere è una textarea per vedere il codice.Per eliminare la tabella creata premi sulle x della tabella.

codice:
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Documento senza titolo</title> </head>  <body>   <script type="text/javascript">  function inseriscitabella() { 	 lavagna=document.getElementById('editor');   source= document.getElementById('source'); 	 //document.getElementById('lavagna').innerHTML="fdfd"; tabella="

Tabella</p><table  id='tabella' width='200' border='1' cellspacing='0' cellpadding='0'><tr><td></td><td></td><td></td></tr></table>";  document.getElementById('editor').innerHTML=tabella;      source.innerHTML=lavagna.innerHTML;    }   function elimina_oggetto(id)   {document.getElementById(id).style.display="none" }          function aggiorna_codice()    { source.innerHTML=lavagna.innerHTML; }  </script>       <DIV id="menu"><button onClick="javascript: inseriscitabella()">Crea tabella</button> </DIV>   <div id="editor"  contenteditable="true" onKeyPress="javascript: aggiorna_codice()" style="border:1px solid #333; height:250px"> </div>  <textarea  cols="100" rows="5" id="source"   style="border:1px solid #333; height:250px"> </textarea>       </body> </html>