那你就用FrontPage嘛,为何非得用Word

解决方案 »

  1.   

    我想在web上操作,并非用软件
      

  2.   

    字符窜查找替换啊。把所有"<span>""</span>"都换成""
      

  3.   

    用Dreamweaver打开页面,在“命令”下有个“清理HTML命令”执行一下,就可以了,里面的参数有个word的选项的
      

  4.   

    用word做的网页会产生大量的垃圾代码,
    所以,建议用Dreamweaver或是FrontPage做网页
    用Dreamweaver打开该html文件
    里面有清理word的垃圾代码的命令。
      

  5.   

    可能是我没表达清楚,我是想把word文件保存成html文件后,在web页用js来清理代码。
    这样不用装其他软件的电脑也能自动执行清理代码了。替换<SPAN>,但其中有很多不定的参数,唉
      

  6.   

    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 ) ;
    }
      

  7.   

    <script language=javascript>
    <!--
    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(/&nbsp;/, " " );// Replace the &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 ) ;
    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>
      

  8.   

    谢谢Jaron(唐伯虎点蚊香),这段东西好啊!!