那你就用FrontPage嘛,为何非得用Word
解决方案 »
- Extjs报错
- 【怪异现象求解】同一个javascript函数中,一个方法被执行,一个却没有
- 在extjs里如何对汉字进行显式编码
- 请教一个比较麻烦的问题
- 用java如何取得showModelDialog传的参数
- 用javascript做的扫雷游戏;求解决俩个问题
- 相同js代码,不同空间有不同结果,为什么?
- js菜鸟求助一个非常简单的问题!!!分不够再加!!!
- 请教:用javascript修改客户端注册表的方法?
- js问题:如何使动态添加的dom可以继续拥有动态添加的能力。(拗口,看正文吧)
- 有没有办法使 Confirm() 的对话框的焦点 落在 取消 按钮上???
- 电影的“在线播放”功能是怎么做的?
所以,建议用Dreamweaver或是FrontPage做网页
用Dreamweaver打开该html文件
里面有清理word的垃圾代码的命令。
这样不用装其他软件的电脑也能自动执行清理代码了。替换<SPAN>,但其中有很多不定的参数,唉
// 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
html = html.replace(/ /, " " );
// 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 ) ;
}
<!--
function cleanWordString( html ) {
html = html.replace(/<\/?SPAN[^>]*>/gi, "" );// Remove all SPAN tags
html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ; // Remove Class attributes
//html = html.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ; // Remove Style attributes
html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;// Remove Lang attributes
html = html.replace(/<\\?\?xml[^>]*>/gi, "") ;// Remove XML elements and declarations
html = html.replace(/<\/?\w+:[^>]*>/gi, "") ;// Remove Tags with XML namespace declarations: <o:p></o:p>
html = html.replace(/ /, " " );// Replace the
// 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 ) ;
test.b.value = html
}
//-->
</script>
<form id=test>
<textarea name=a cols=60 rows=13></textarea><br>
<textarea name=b cols=60 rows=13 ID="b"></textarea>
<input type=button onclick="cleanWordString(test.a.value);" value=转换>
</form>