<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>+&nbsp; =</title>
<script type="text/javascript">
    function init() {
     var html = '<html><head>\n'
     + '<style>\n'
     + 'p { margin:2pt 2pt 2pt 2pt; }\n'//改变它改变行距
     + '</style>\n'
      + '</head>\n'
      + '<body contenteditable="true" topmargin=1 leftmargin=1>'
      + 'aaaaaa'
      + '</body>\n'
      + '</html>\n';
      var editdoc = document.all["MsgFrame"].contentWindow.document;
      editdoc.open();
    editdoc.write(html);
    editdoc.close();
    }
</script></head>
<body onload="init()">
<form>
<iframe style="width: 100%; height:100;line-height:30px;" marginwidth="0"   marginheight="0" frameborder="1" id="MsgFrame"  src="about:blank"></iframe>
</form>
</body>
</html>

解决方案 »

  1.   

    可是行内没有标记<p>怎么办呢,又没有可以设置的方法?
      

  2.   

    adverse(King) ( )
    你的方法不行的,实现不了的
      

  3.   

    <script  type=  "text/javascript  "  >  
           function  init()  {  
                       var  html  =  '  <html  >  <head  >\n'  
                                +  '  </head  >\n'  
               +  '  <body  style="line-height:40px;" >'  
               +  'aaaaaa'  
               +  '  </body  >\n'  
               +  '  </html  >\n';  
               var  editdoc  =  document.all[  "MsgFrame  "].contentWindow.document;  
               editdoc.open();  
           editdoc.write(html);  
           editdoc.close();  
           }  
     </script  >  
    用这种方式试出来了.