1.clipboardData.clearData("Text");
2.clipboardData.setData("Text","");
3.document.selection.empty();document.execCommand("copy");

解决方案 »

  1.   

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    <script>function show(){
    //document.execCommand("Clear")
    window.clipboardData.clearData("Text");
    //copiedtext=window.clipboardData.getData("Text");
    //alert(copiedtext);
    }</script>
    </head><body>
    <form method="POST" action="--WEBBOT-SELF--">
      <!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt"
      S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
      <p>dsffds<input type="text" name="T1" size="20" onfocus=show()>
      <input type="submit" value="提交" name="B1"><input type="reset" value="全部重写" name="B2"></p> 
    </form> 
     
    <p align=center><input type=button onclick=show() value="显示粘贴板"> 
     
     
    </body> 
     
    </html> 
      

  2.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>Example of the clearData Method</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
    <META NAME="AUTHOR" CONTENT="InetSDK">
    <META NAME="MS.LOCALE" CONTENT="EN-US">
    <META NAME="ROBOTS" CONTENT="noindex"><!-- STYLE_START -->
    <LINK REL="stylesheet" HREF="/workshop/basicSDKIE4.css" TYPE="text/css">
    <LINK REL="stylesheet" HREF="/workshop/advSDKIE4.css" TYPE="text/css">
    <!-- STYLE_END --><STYLE>
    DIV  { width: 300; background-color:magenta;  }
    SPAN  { color:lightseagreen;  }
    </STYLE><SCRIPT>
    var sGetData;function Source_DragStart(){
      event.dataTransfer.setData("Text", "This text should be cleared");
    }
    function Target_Enter() 
    {
      window.event.returnValue = false;
      event.dataTransfer.clearData("Text");
      oTarget.innerText = event.dataTransfer.getData("Text");}
    </SCRIPT>
    </HEAD>
    <!--TOOLBAR_START-->
    <!--TOOLBAR_EXEMPT-->
    <!--TOOLBAR_END--><BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF" LINK="#000000" VLINK="#808080" ALINK="#000000">
    <BLOCKQUOTE CLASS="body"><!-- CONTENTS_START -->
    <H1>Example of the clearData Method</H1><P>The example demonstrates how to use event.dataTransfer.clearData('Text') to clear the clipboard.
    <P>In this example, the string "This text should be cleared" is passed in the <B>setData</B> method. 
    The <B>clearData</B> method clears it. It also clears the text being dragged so that it does not appear in the <B>DIV</B> upon completion of the data transfer operation. This method is particularly useful for selectively removing data formats when multiple formats are specified.</P><P>Highlight the green text. Then drag it and drop it over the magenta <B>DIV</B>.</P>
    <SPAN ID="oSource" ondragstart="Source_DragStart()">drag this text</SPAN>
    <BR><BR>
    <P>Drop the text below. Null will appear when the <B>clearData</B> method is successfully invoked.
    <DIV ID="oTarget" ondragenter="Target_Enter()">
    </DIV>
    <!-- CONTENTS_END --><!-- START_PAGE_FOOTER -->
    <BR><BR><BR>
    &copy; <A CLASS="clsIncCpyRt" HREF="http://www.microsoft.com/isapi/gomscom.asp?TARGET=/info/cpyright.htm" TARGET="_top"> 2002 Microsoft Corporation. All rights reserved. Terms of use</A>.
    <!-- END_PAGE_FOOTER -->
    </BLOCKQUOTE>
    </BODY>
    </HTML>