欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

js清理Word格式示例代码_javascript技巧

程序员文章站 2022-05-07 08:58:43
...
复制代码 代码如下:



cleanWord = function(){
var editBody = FCKeditorAPI.GetInstance("text").EditorDocument.body;
var html = FCKeditorAPI.GetInstance("text").EditorDocument.body.innerText;
for(var intLoop=0;intLoopel=editBody.all[intLoop];
  el.removeAttribute("className","",0);
  el.removeAttribute("style","",0);
  el.removeAttribute("font"," ",0);
}
html=html.replace(/

/g,"");
html=html.replace(/o:/g,"");
html=html.replace(//g,"");
html=html.replace(//g,"");
html=html.replace(//g,"");
html=html.replace(//g,"");
html=html.replace(//g,"");
html=html.replace(/

/g,"");
html=html.replace(//g,"");
html=html.replace(//g,"");
FCKeditorAPI.GetInstance("text").EditorDocument.body.innerText=html;
}

相关标签: Word格式