从iframe可编辑的区域获取可编辑区域的标签
  我已经创建了一个小编辑器,我已经做了几个命令作为示例字体格式和 
  对齐等,所以它在浏览器中工作正常,但我想导出写入的数据 
  在可编辑区域,而我试图获取可编辑的iframe中的数据,但它给了我一个错误。 
  错误消息:未捕获ReferenceError:innerDoc未定义 
  下面的代码被写入 
  <HTML> <HEAD> <TITLE> </ TITLE> 
  <SCRIPT> 
  函数iFrameOn(){ 
  richTextField.document.designMode ='开'; 
  } 
  函数export_Data(){ 
  var n = document.getElementById(“richTextField”); 
  var innerdoc = n.contentDocument ||  n.contentWindow.document; 
  var input = innerDoc.getElementsByTagName('body')。text; 
  var zip = new JSZip(); 
  zip.add(“hello1.html”,“”+ input); 
  zip.add(“hello2.js”,“这只是一个简单的文件”); 
  content = zip.generate(); 
  location.href =“data:application / zip; base64,”+ content; 
  </ script> </ head> 
  <BODY> 
  <iframe name =“richTextField”id =“richTextField”class =“form-control”style =“height:100%; word-wrap:break-word;”> 
  <button onclick =“export_Data()”name =“导出”>导出信息</ button> 
  </ BODY> 
  </ HTML> 
请帮我解决这个问题
如果它位于同一个域中,请尝试此操作。 如果iframe与您正在查看的窗口的来源不同,它不会让您访问iframe内容。
var n = document.getElementById("richTextField");
var innerdoc  = n.contentDocument.body.innerHTML;
上一篇: get the content as well tags of the editable area from iframe editable
