- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi tms web core 复制内容到剪切板
首先需要用到:
http://www.clipboardjs.cn/
clipboard.js
现代化的拷贝文字
不依赖flash, 不依赖其他框架,gzip压缩后只有3kb大小
index.html 引用:
webmemo1 getElementById设置为:txt1
WebButton1 getElementById 设置为:copy
procedure TForm1.WebButton1Click(Sender: TObject);
begin
asm
var clipboard = new ClipboardJS('#copy', {
text: function() {
return document.getElementById('txt1').value;
}
});
clipboard.on('success', function(e) {
// layer.msg('复制成功!');
});
clipboard.on('error', function(e) {
// layer.msg('复制失败!');
});
end;
end;
没有啥原创不原创,随便转载分享 ---- delphitop.com