加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 教程 > 正文

查看JS移除Word样例程序的版本

发布时间:2023-10-11 15:04:31 所属栏目:教程 来源:
导读:代码如下:

<input type="button" onclick="cleanWord();" value="Word清理" />

cleanWord = function(){

var editBody = FCKeditorAPI.GetInstance("text").EditorDocument.body;

var html = FCKedi
代码如下:
 
<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;
 
}
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章