复制代码代码如下:
<input type = "button" onclick = "cleanword ();" value = "Word 清理" />
CleanWord = function () {
var editbody = fckeditorapi.getinstance ("text"). Editordocument.Body;
var html = fckeditorapi.getinstance ("text"). Editordocument.body.innerText;
for (var intloop = 0; intloop <editbody.all.length; intloop ++) {
el = editbody.all [intloop];
el.removeattribute ("classname", "", 0);
el.removeattribute ("style", "", 0);
el.removeattribute ("font", "", 0);
}
html = html.replace (/<o: p> <// o: p>/g, "");
html = html.replace (/o:/g, "");
html = html.replace (/<font>/g, "");
html = html.replace (/<font>/g, "");
html = html.replace (/<pan>/g, "");
html = html.replace (/<pan>/g, "");
html = html.replace (/<spanlang = en-us>/g, "");
html = html.replace (/<p>/g, "");
html = html.replace (/<// p>/g, "");
html = html.replace (/<// span>/g, "");
Fckeditorapi.getinstance ("text"). Editordocument.body.innertext = html;
}