js清理Word格式示例代码
js清理Word格式示例代码
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:cleanWord=function(){vareditBody=FCKeditorAPI.GetInstance("te...

复制代码 代码如下:

<input type="button" 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(/<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;

}

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新Javascript教程学习
热门Javascript教程学习
编程开发子分类