如何用js清除剪贴板的内容? 1.clipboardData.clearData("Text");2.clipboardData.setData("Text","");3.document.selection.empty();document.execCommand("copy"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <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> <!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>© <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> 急急急:从JS中取值,在火狐中显示乱码,在IE9是好的,有人遇到过类似的问题吗? 求解 PHP JS批量删除问题!!! 请问怎么显示分级的留言?树状? 关于JS的问题(如何把得到的值重新设回HTML代码中) 如何实现树形结构与单击事件的配合显示? 求一javascript時候選擇控件,要求可在框架上面的 鼠标拖动层或者其他! 在线等待。马上给分 ---有关表格的行数和列数 iframe 问题 急!!! ****进来看看这个网页的问题**** 如何控制IE当中的“文件”菜单下的“页面设置”的内容???急! 请问怎么屏蔽网页的原代码?
<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>
<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>
© <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>