网站制作

本类阅读TOP10

·IIS 安装配置全攻略
·用VS.NET打开网上下载的.NET web项目出错的解决办法
·HTML 4.0 语言快速参考
·限制TextArea区的文字输入数量
·如何在网页上实现进度条
·Apache的配置步骤及测试
·谈谈Jesse James Garrett提到的Ajax
·html基础学习笔记(2)
·页面垂直居中的两种方法
·用asp遍历目录下文件的例子

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
清除WORD冗余格式并粘贴

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

/ 清除WORD冗余格式并粘贴
function cleanAndPaste( html ) {
 // Remove all SPAN tags
 html = html.replace(/<\/?SPAN[^>]*>/gi, "" );
 // Remove Class attributes
 html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
 // Remove Style attributes
 html = html.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ;
 // Remove Lang attributes
 html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
 // Remove XML elements and declarations
 html = html.replace(/<\\?\?xml[^>]*>/gi, "") ;
 // Remove Tags with XML namespace declarations: <o:p></o:p>
 html = html.replace(/<\/?\w+:[^>]*>/gi, "") ;
 // Replace the &nbsp;
 html = html.replace(/&nbsp;/, " " );
 // Transform <P> to <DIV>
 var re = new RegExp("(<P)([^>]*>.*?)(<\/P>)","gi") ; // Different because of a IE 5.0 error
 html = html.replace( re, "<div$2</div>" ) ;
 
 insertHTML( html ) ;
}


相关文章

相关软件