複製代碼代碼如下:
<輸入type =“ button” onclick =“ cleanword();” value =“ word清理” />
cleanword = function(){
var editbody = fckeditorapi.getInstance(“ text”)。editordocument.body;
var html = fckeditorapi.getInstance(“ text”)。editodocument.body.innertext;
for(var intloop = 0; intloop <editbody.all.length; intloop ++){
el = editbody.all [intloop];
el.removeatTribute(“ className”,“”,0);
el.removeatTribute(“樣式”,“”,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(/<span>/g,“”);
html = html.replace(/<span>/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;
}