ZeroClipboard_copy
//<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();
});
}
ZeroClipboard_copy的更多相关文章
随机推荐
- 未整理js
函数+对象=方法 方法是动作 有参数的函数=实例 使用new关键字和函数来创建一个实例 var p =new Point(1,1)//平面几何的点 表示遍历的语句样子: for(var i =0; i ...
- Android-->RxJava2更新体验
截止日前最新版2017-3-15: RxJava compile ‘io.reactivex:rxjava:’ compile ‘io.reactivex:rxandroid:’ RxJava2 co ...
- 【Java/Android性能优5】 Android ImageCache图片缓存,使用简单,支持预取,支持多种缓存算法,支持不同网络类型,扩展性强
本文转自:http://www.trinea.cn/android/android-imagecache/ 主要介绍一个支持图片自动预取.支持多种缓存算法.支持二级缓存.支持数据保存和恢复的图片缓存的 ...
- Swagger的使用
参考文章: https://blog.csdn.net/xupeng874395012/article/details/68946676/ https://blog.csdn.net/hry2015 ...
- 微信jssdk实现分享到微信
本来用的是这个插件http://overtrue.me/share.js/和百度分享 相同之处:在微信分享的时候,分享的链接都不能获取到缩略图... 不同之处:百度分享在微信低版本是可以看到缩略图的( ...
- js高级笔录
1.类型转换①转换成字符串toString() ⅰBoolean 值.数字和字符串的原始值的有趣之处在于它们是伪对象,这意味着它们实际上具有属性和方法. var sColor = "red& ...
- IOS 自定义导航栏背景
//- (void)setBackgroundImage:(UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics NS_AV ...
- 分布式版本控制系统git
最近看到这篇文章,简洁易懂,特摘抄至https://www.cnblogs.com/bgwhite/p/9403233.html 供大家提供参考. git可以说是世界上最先进的版本控制系统,大多语句的 ...
- python_69_内置函数1
#abs()取绝对值 ''' all(iterable) Return True if all elements of the iterable are true (or if the iterabl ...
- flush caches