展会信息港展会大全

js清理Word格式示例代码
来源:互联网   发布日期:2016-03-24 20:07:46   浏览:1322次  

导读:这篇文章主要介绍了使用JS清理Word格式的方法,需要的朋友可以参考下 代码如下: input type=button onclick=cleanWord(); value=Word清理 / cleanWord = function(){ var editBody = FCKeditorAPI.GetInstance(text).EditorDocument.body; var html = FCKedit...

这篇文章主要介绍了使用JS清理Word格式的方法,需要的朋友可以参考下

代码如下:

<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(/<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;

}

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港