zoukankan      html  css  js  c++  java
  • js复制黏贴

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8" />
    <title>ZeroClipboard demo实例</title>
    		<script src="http://web.2144.cn/static/core/jquery.min.js"></script>
            <script src="js/ZeroClipboard.js"></script>
        <script>
                    $(function(){
                            var clip = new ZeroClipboard( document.getElementById("copy-button"), {
                              //<span style="color: #1d1d1d; font-family: tahoma, arial, 宋体; letter-spacing: 1px; line-height: 29px; white-space: normal; background-color: #ffffff;">指定ZeroClipboard.swf的路径</span>
                              moviePath: "js/ZeroClipboard.swf" 
                            } );
                            
                            clip.on( 'load', function(client) {
                              // alert( "movie is loaded" );
                            } );
                            
                            clip.on( 'complete', function(client, args) {
                              //this.style.display = 'none'; // "this" is the element that was clicked
                              alert("复制成功,复制的内容为: " + args.text );
                            } );
                            
                            clip.on( 'mouseover', function(client) {
                              // alert("mouse over");
                            } );
                            
                            clip.on( 'mouseout', function(client) {
                              // alert("mouse out");
                            } );
                            
                            clip.on( 'mousedown', function(client) {
                                    //在这里为剪贴板赋值
                                    clip.setText($("#_input").text());
                            } );
                            
                            clip.on( 'mouseup', function(client) {
                              // alert("mouse up");
                            } );
                    });
        </script>
    </head>
    <body>
    
    	<button id="copy-button" title="复制到剪贴板">复制到剪贴板</button>
    	<input type="text">
    	<span id="_input">5645644444</span>
    
    
    
    
    
    
    
    </body>
    </html>
    

      

  • 相关阅读:
    Open_basedir 开启后项目变慢
    PHP导入百万级excel数据方案
    使用Python统计项目代码行数(Python3.X)
    AttributeError: '_io.TextIOWrapper' object has no attribute 'xreadlines'
    startTime = time.clock()AttributeError: module 'time' has no attribute 'clock
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print
    误删 Win10 应用商店应该如何恢复?
    win10无法开启Windows Defender Firewall服务,错误1058
    设备管理器里面的AAP Server是什么?
    layui——Cannot create property 'LAY_TABLE_INDEX' on number '2'
  • 原文地址:https://www.cnblogs.com/xupeiyu/p/4063503.html
Copyright © 2011-2022 走看看