之前工作中需要用到獲取iframe中的整段html代碼,所以研究了下
代碼 "iframe的id"
var doc;
if (document.all){ // IE
doc = document.frames["ueditor_0"].contentWindow;
}else{ // 標準
doc = document.getElementById("ueditor_0").contentWindow;
}
//用一個變量承接html代碼段
var text = doc.document.body.innerHTML;