//<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();
});
}

最新文章

  1. 使用 GCC 和 GNU Binutils 编写能在 x86 实模式运行的 16 位代码
  2. S1:变量
  3. [转]Oracle关于null的处理
  4. Jordan Lecture Note-9: Principal Components Analysis (PCA).
  5. [支付]银联支付(对jdk有要求,最好直接使用jdk7)
  6. 国内IT技术博客对比
  7. 使用 FreeMarker 替换 JSP 的 10 个理由
  8. mysql应用技巧
  9. zabbix通过SNMP监控服务器硬件及构建触发器
  10. Linux 复习
  11. LeetCode &amp; Q38-Count and Say-Easy
  12. Vue源码实现
  13. Android6.0以上系统动态获取权限
  14. 【BUAA-OO】第二单元作业总结
  15. 【bug记录】OS Lab3 踩坑记
  16. yarn 常用命令
  17. 【网站seo优化】SEO优化每天的工作内容是什么?
  18. MyBatis基础入门《九》ResultMap自动匹配
  19. Lazarus的DBGrid中回车键的处理
  20. Java实现后缀表达式建立表达式树

热门文章

  1. 可视化工具Navicat的使用/pymysql模块的使用
  2. Vue2.0搭建脚手架(vue-cli)
  3. Catch the moments of your life. Catch them while you&#39;re young and quick.
  4. windows无法连接到打印机 操作失败,错误为0x00000002 解决方案
  5. 【MFC】0xC0000005: 读取位置 0x00000020 时发生访问冲突
  6. 常用工具使用(sublimeText)
  7. LeetCode Unique Binary Search Trees (DP)
  8. VMware Workstation Pro 11、12 密钥
  9. getline()读入一整行
  10. 富文本编辑器Ueditor的使用