如何在textarea中显示html代码

XML/HTML代码
  1. <html>  
  2. <head>  
  3. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">  
  4. <title>新建网页</title>  
  5. </head>  
  6. <body>  
  7. <table border="1" width="100%" id="tab">  
  8.          <tr>  
  9.                  <td>内容</td>  
  10.          </tr>  
  11. </table>  
  12. <textarea rows="23" cols="91" id="txt">  
  13. </textarea>  
  14. <script>  
  15. document.getElementById("txt").appendChild(document.getElementById("tab"))   
  16. </script>  
  17. </body>  
  18. </html>  
posted @ 2008-06-20 23:43  二宝的博客  阅读(1252)  评论(0编辑  收藏  举报