Zero Clipboard實現瀏覽器複製到剪貼簿(多個複製按鈕)

來源:互聯網
上載者:User
<script type="text/javascript" src="{$site_url}/Public/js/ZeroClipboard.js"></script> <script language="JavaScript">$(function(){   $(".my_clip_button").each(function(i){    var id = $(this).attr('data');var clip=null;clip = new ZeroClipboard.Client();ZeroClipboard.setMoviePath("{$site_url}/Public/js/ZeroClipboard.swf"); //設定 不然要放在網站根目錄下才顯示clip.setHandCursor( true );clip.setText( $("#txtInvite_"+id).val() );      clip.addEventListener('complete', function (client, text) {   ui.success( "恭喜複製成功" );    });    clip.glue( 'd_clip_button_'+id ,'d_clip_container_'+id );   });});</script><style>.my_clip_button { width:62px; text-align:center; height:20px;border:1px solid black; background-color:#ccc; margin:2px; padding:2px; cursor:default; font-size:9pt; }.my_clip_button.hover { background-color:#eee; }.my_clip_button.active { background-color:#aaa; }</style>

 <div style="width:90%;margin:0 auto; height:50px;line-height:20px;">         <table width="100%" border="0" cellspacing="0" cellpadding="0">              <tr>                <td width="19%" height="45" align="right">預設邀請連結:</td>                <td width="52%"><input type="text" name="txtInvite_default" id="txtInvite_default" value="{$defaultInviteLink}" style="width:350px;" /></td>                <td width="31%">                    <div id="d_clip_container_default" style="position:relative;">                        <div id="d_clip_button_default" class="my_clip_button" data="default">複製</div>                    </div>                </td>              </tr>            </table>          </div>                 <volist name="invitelists" id="vo">           <div style="width:90%;margin:0 auto; height:50px;line-height:20px;">         <table width="100%" border="0" cellspacing="0" cellpadding="0">              <tr>                <td width="19%" height="45" align="right">{$vo.group_name}專用邀請連結:</td>                <td width="52%"><input type="text" name="txtInvite_{$vo.id}" id="txtInvite_{$vo.id}" value="{$vo.invitelink}" style="width:350px;" /></td>                <td width="31%">        <div id="d_clip_container_{$vo.id}" style="position:relative;">                        <div id="d_clip_button_{$vo.id}" class="my_clip_button" data="{$vo.id}">複製</div>                    </div>                </td>            </tr>         </table>        </div>        </volist> 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.