复制到剪切板

2020年12月11日 | 分类: js | 评论: 0 | 浏览: 918
function jqb(str){	var div = document.createElement('div');
	var txt = document.createElement('input');
	div.style.width = '0';
	div.style.height = '0';
	div.style.position = 'fixed';
	div.style.right = '0';
	div.style.bottom = '0';
	div.style.opacity = '0';
	txt.value = str;
	txt.style.width = '1';
	txt.style.height = '1';
	div.appendChild(txt);	document.body.appendChild(div);
	txt.select();	document.execCommand("Copy", "false", null);	document.body.removeChild(div);
}


顶一下 ▲()
踩一下 ▼()
发表留言
登录后才能发表留言,立即 登录注册
提交 (Ctrl+Enter)
Copyright 2020-2024 xaoi博客 All Rights Reserved.