New Document





<script>
function GetClipboardHTML()
{
var oDiv = document.getElementById("divTemp")
oDiv.innerHTML = "" ;

var oTextRange = document.body.createTextRange() ;
oTextRange.moveToElementText(oDiv) ;
oTextRange.execCommand("Paste") ;

var sData = oDiv.innerHTML ;
oDiv.innerHTML = "" ;

return sData ;
}


function cleanAndPaste( html )
{
// Remove all SPAN tags
html = html.replace(/ ]*>/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:
html = html.replace(/ ]*>/gi, "") ;
// Replace the
html = html.replace(/ /, " " );
// Transform

to


var re = new RegExp("( ]*>.*?)( )","gi") ;// Different because of a IE 5.0 error
html = html.replace( re, "
" ) ;

//insertHtml( html ) ;

//return html;

Form1.my.value = html;
}

function Paste()
{
var sHTML = GetClipboardHTML() ;

var re = /]* class="?MsoNormal"?/gi ;
var re2 = /]* class="?xl"?/gi ;
if ( re.test( sHTML ) )
{
alert("您要粘贴的内容好像是来自 MS Word,系统将清除 MS Word 格式后再粘贴!")
}

if ( re2.test( sHTML ) )
{
alert("您要粘贴的内容好像是来自 MS Excel,系统将清除 MS Excel 格式后再粘贴!")
}
cleanAndPaste( sHTML ) ;
}
</script>









style="VISIBILITY: hidden; OVERFLOW: hidden; WIDTH: 1px; POSITION: absolute; HEIGHT: 1px">