ZeroClipboard_copy
2024-09-24 13:44:48
//<script src="js/ZeroClipboard.js" type="text/javascript"></script>
//ZeroClipboard.js
//ZeroClipboard.swf
//用ZeroClipboard容器,实现页面表格数据copy
//--用字符串拼html
function copyTable(data,mode,outtype){
var html=[];
html.push("<html>");
html.push("<head>");
html.push("<style>");
html.push("td{border:1px solid #A3C0E8;overflow:hidden;white-space:nowrap;}");
html.push(".htd{background-color:#00619C;color:#FFFFFF}");
html.push(".std{font-weight: bold;}");
html.push(".gtd{background-color:#DDDDDD;}");
html.push("</style></head><body><table>");
html.push("<tr>");
html.push("</tr>");
html.push("</table></body></head></html>"); return html.join("");
}
//容器的大小是有限的,一般到100万个字左右,超过容器空间大小,copy失效
function init(mode,outtype) {
ZeroClipboard.setMoviePath("js/ZeroClipboard.swf");
clip = new ZeroClipboard.Client();
clip.setHandCursor(true);
var result="";
clip.addEventListener('mousedown', function(client) { //拼table返回的html文
result = copyTable(copyDatatmp,mode,outtype);
clip.setText(result); }); clip.addEventListener('complete', function(client, text) {
if (result.length>800000) {
alert("数据容量太大,copy失效。");
}else {
clip.reposition();
alert("copy完了!");
} }); clip.glue("copymt"); $(window).resize(function() {
clip.reposition();
});
}
最新文章
- 使用 GCC 和 GNU Binutils 编写能在 x86 实模式运行的 16 位代码
- S1:变量
- [转]Oracle关于null的处理
- Jordan Lecture Note-9: Principal Components Analysis (PCA).
- [支付]银联支付(对jdk有要求,最好直接使用jdk7)
- 国内IT技术博客对比
- 使用 FreeMarker 替换 JSP 的 10 个理由
- mysql应用技巧
- zabbix通过SNMP监控服务器硬件及构建触发器
- Linux 复习
- LeetCode &; Q38-Count and Say-Easy
- Vue源码实现
- Android6.0以上系统动态获取权限
- 【BUAA-OO】第二单元作业总结
- 【bug记录】OS Lab3 踩坑记
- yarn 常用命令
- 【网站seo优化】SEO优化每天的工作内容是什么?
- MyBatis基础入门《九》ResultMap自动匹配
- Lazarus的DBGrid中回车键的处理
- Java实现后缀表达式建立表达式树
热门文章
- 可视化工具Navicat的使用/pymysql模块的使用
- Vue2.0搭建脚手架(vue-cli)
- Catch the moments of your life. Catch them while you&#39;re young and quick.
- windows无法连接到打印机 操作失败,错误为0x00000002 解决方案
- 【MFC】0xC0000005: 读取位置 0x00000020 时发生访问冲突
- 常用工具使用(sublimeText)
- LeetCode Unique Binary Search Trees (DP)
- VMware Workstation Pro 11、12 密钥
- getline()读入一整行
- 富文本编辑器Ueditor的使用