如何得到 windows 系统命令中 Copy 所得到的字符串(付给一个自定义变量)

arrow_gx 2002-03-18 09:22:17
如何得到 windows 系统命令中 Copy 所得到的字符串(付给一个自定义变量)
...全文
40 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
孟子E章 2002-03-18
  • 打赏
  • 举报
回复
getData Method

Retrieves the data in the specified format from the clipboard through the dataTransfer or clipboardData objects.


Examples

The following examples use the setData and getData methods of the dataTransfer object to drop text in a new location and create a desktop shortcut.
This example uses the getData method to drag text and drop it in a new location.

<HEAD>
<SCRIPT>
function InitiateDrag(){
event.dataTransfer.setData(oSource.innerText);
}

function FinishDrag(){
window.event.returnValue=false;
oTarget.innerText = event.dataTransfer.getData("Text");
}
function OverDrag(){
window.event.returnValue=false;
}
</SCRIPT>
</HEAD>
<BODY>

<B ID="oSource"
ondragstart="InitiateDrag()">
drag this text</B>

<SPAN ID="oTarget"
ondragover="OverDrag()"
ondragenter="FinishDrag()"">
drop text here</SPAN>

</BODY>

老翔 2002-03-18
  • 打赏
  • 举报
回复
yourform.A_Hidden_Inputbox.value = document.execCommand("Paste")
yourvalue = yourform.A_Hidden_Inputbox.value

87,996

社区成员

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

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