所谓文本编辑器 :
1. 将iframe 通过js 设定为可编辑
<iframe id="inputArea" contenteditable="true" style="border:solid 1px;width: 100%;height: 100px;background-color: #fff" ></iframe>
function
init() {
ifr = document.getElementById("inputArea");
doc = ifr.contentDocument || ifr.contentWindow.document; // W3C || IE
doc.designMode="on";
//doc.contentEditable=true; 这个貌似不适合iframe适合P div 之类的其余标签
alert($("#divInput").html());
alert(doc.body.innerHTML);
}
2. div p之类的标签加上 contenteditable="true"
<div contenteditable="true" id="divInput" style="width: 100px;height: 100px"></div>