首页 > 代码库 > Zclip-jquery插件支持全浏览器复制
Zclip-jquery插件支持全浏览器复制
1.Zclip-jquery插件需要浏览器支持flash10及以上,现在的浏览器基本都支持
2.http://www.steamdev.com/zclip/下载相关组件:
query.zclip.min.js
ZeroClipboard.swf
去网上找个jquery框架:jquery.min.js
代码实现:
<html><meta charset="UTF-8"> <style>a:active, a:hover { outline:0 }a { text-decoration:none; outline:0 }.clr { clear:both; height:0; }a.react { display:block; color:inherit; height:100%; text-decoration:none; }a.react:active, a.react.react-active { background:rgba(0, 0, 0, .1) }.fuzhi { width:60px; height:30px; line-height:30px; background:#fa870b; cursor:pointer; color:#fff; display:block; text-align:center; font-size:.75em; outline:0; float:left; }.fz2 { margin:0 auto; -webkit-border-radius:2px;-moz-border-radius:2px; border-radius:2px; }</style><script type="text/javascript" src="jquery.min.js"></script><script type="text/javascript" src="jquery.zclip.min.js"></script><script type="text/javascript"> $(function(){ $(‘#copy‘).zclip({ path: ‘ZeroClipboard.swf‘ , //copy: $(‘#qh‘).text(), //复制div,<span>,<p>等标签的内容 copy: function(){ return $(‘#qh‘).val() //复制input,textarea等内容 }, afterCopy: function(){ $(‘#copy‘).html(‘复制成功‘)//复制成功,可以省略 } }); }); </script><body><textarea style="width:250;height:200" id="qh">zClip is a lightweight jQuery "copy to clipboard" plugin built using the popular Zero Clipboard library. This plugin uses an invisible Adobe Flash movie that is fully compatible with Flash Player 10 and below.</textarea><br /><!--</span id ="qh">zClip is a lightweight jQuery "copy to clipboard" plugin built using the popular Zero Clipboard library. This plugin uses an invisible Adobe Flash movie that is fully compatible with Flash Player 10 and below. </span><br />--><a href="javascript:void(0);" class="fuzhi fz2" id="copy" >复 制</a></body></html>
Zclip-jquery插件支持全浏览器复制
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。