TAG:
<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(/ /, " " );// 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> ---------------------------------------------- CSDN WebDev ASP,IIS fourm master SiteManager-CMS Developer Public-Secure-Office Information scheme Provider ChinaDNS Partner Welcome to visit: ![]() |