请问,clipboardData这些东东是做什么的?

pyz8000 2002-11-30 03:43:58
好像这个很实用,哪里有这方面的详细说明???网址???
高手,留言啊~~~
...全文
32 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
pyz8000 2002-12-01
  • 打赏
  • 举报
回复
my go
俺不懂英文啊
chenbinghui 2002-12-01
  • 打赏
  • 举报
回复
clipboardData 是用在控制剪切版
有clearData,setData,getData三个方法
setData(sDataFormat, sData)
sDataFormat有两个值,Text URL
setData("Text","83729834298347")
就可以把"83729834298347"copy到剪切版
潇洒 2002-12-01
  • 打赏
  • 举报
回复
hehe~~ 就是剪贴板.
可以实现将"数据"复制到剪贴板..或从剪贴板上获得"数据".

这个的资料我也没看过中文的, 也是在 msdn 里学的.
(俺 e 文也不行.只是半懂不懂...)
junguo 2002-11-30
  • 打赏
  • 举报
回复
msdn上的资料

The clipboardData object is reserved for editing actions performed through the Edit menu, shortcut menus, and shortcut keys. It transfers information using the system clipboard, and retains it until data from the next editing operation supplants it. This form of data transfer is particularly suited to multiple pastes of the same data.

This object is available in script as of Microsoft® Internet Explorer 5.

Example

This example uses the setData and getData methods with the clipboardData object to perform a cut-and-paste operation through the shortcut menu.

Hide Example

<HTML>
<HEAD>
<SCRIPT>
var bResult;
// Select the text to be cut. Trailing spaces in a text
// selection in cut events cause the Cut shortcut menu item to
// remain disabled.
function fnLoad() {
var r = document.body.createTextRange();
r.findText(oSource.innerText);
r.select();
}
// Enable the Cut shortcut menu item over the DIV. Cut is disabled by default.
// Once Cut is enabled, Internet Explorer automatically copies the data to the
// clipboard and removes the selected text from the document.
function fnBeforeCut() {
event.returnValue = false;
}
//Assign data in text format to the window.clipboardData object.
//Display the result (Boolean) from the setData method in the input box below.
function fnCut(){
event.returnValue = false;
bResult = window.clipboardData.setData("Text",oSource.innerText);
oSource.innerText = "";
tText.innerText += bResult;
}
// Enable the Paste shortcut menu item over the DIV. Paste is disabled by default.
function fnBeforePaste() {
event.returnValue = false;
}
// Cancel the returnValue in onpaste for the text input, which
// has a default behavior.
function fnPaste() {
event.returnValue = false;
oTarget.innerText = window.clipboardData.getData("Text");
}
</SCRIPT>
</HEAD>

<BODY onload="fnLoad()" TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="fixed" BGCOLOR="#FFFFFF"
LINK="#000000" VLINK="#808080" ALINK="#000000">

<DIV CLASS="clsSource" ID="oSource" onbeforecut="fnBeforeCut()" oncut="fnCut()">
Select and cut this text
</DIV>
<DIV CLASS="clsTarget" ID="oTarget" onbeforepaste="fnBeforePaste()" onpaste="fnPaste()">
Paste the Text Here
</DIV><BR>

<SPAN CLASS="clsData">setData Result: </SPAN>
<INPUT CLASS="clsText" ID="tText" TYPE="text" READONLY VALUE="" SIZE="6" TABINDEX="-1">

</BODY>
</HTML>
Show Me
Standards Information

There is no public standard that applies to this object.

87,975

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧