社区
JavaScript
帖子详情
请教JS Copy字串到剪贴板的问题
angelhyli
2004-10-13 06:48:50
我想实现这样的效果,将传入的字串Copy到剪贴板中,而不是将document中选中的部分Copy过去。请问有没有这样的函数?能不能不用document.selection.createRange()?
<SCRIPT LANGUAGE="JScript">
function Copyto1(seltxt)
{
document.execCommand("Copy","true",seltxt);
}
</SCRIPT>
...全文
263
2
打赏
收藏
请教JS Copy字串到剪贴板的问题
我想实现这样的效果,将传入的字串Copy到剪贴板中,而不是将document中选中的部分Copy过去。请问有没有这样的函数?能不能不用document.selection.createRange()? function Copyto1(seltxt) { document.execCommand("Copy","true",seltxt); }
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
2 条
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
打赏红包
chinchy
2004-10-13
打赏
举报
回复
//将变量内容复制到剪切板
function CopyTo(str)
{
clipboardData.setData('text',str)
}
是是非非
2004-10-13
打赏
举报
回复
clipboardData.setData('Text',stringAnything);
相关推荐
js
实现复制到
剪贴板
(IE,firefox)
以下是
js
实现复制到
剪贴板
的代码:// function
copy
_clip(
copy
){if (window.clipboardData){window.clipboardData.setData("Text",
copy
);}else if (window.netscape){try { netscape.security.PrivilegeManager.ena
js
实现点击
copy
,可兼容
使用
js
实现可兼容的点击,
copy
内容到
剪贴板
。
js
实现复制到
剪贴板
通过
js
复制到
剪贴板
let aux = document.createElement("input"); aux.setAttribute("value",`复制
剪贴板
内容`); document.body.appendChild(aux); aux.select(); document.execCommand("
copy
"); document.body.removeChild(aux);...
JS
点击按钮复制固定内容到
剪贴板
JS
点击按钮复制固定内容到
剪贴板
const input = document.createElement('input'); document.body.appendChild(input); input.setAttribute('value', `复制的内容`); input.select(); if (document.execCommand('
copy
')) { document.execCommand('
copy
'); } document.body.rem
js
复制文本到
剪贴板
_如何将输出文本从命令行复制到Windows
剪贴板
js
复制文本到
剪贴板
If you’re doing work at the command line on your Windows box, it’s sometimes useful to
copy
the output of a command to the clipboard, but who wants to try and scroll and click to use
copy
an...
发帖
JavaScript
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
8.7w+
社区成员
22.4w+
社区内容
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
帖子事件
创建了帖子
2004-10-13 06:48
社区公告
暂无公告