借助flash复制剪切板工作

<!—剪贴板复制 start–>
<script type=”text/javascript” src=”__PUBLIC__/copy2/jquery-1.js”></script>
<script src=”” target=”_blank”>http://cdn.bootcss.com/zerocl…
<script type=”text/javascript”>

var client = new ZeroClipboard($('.copy'));
client.on('ready', function (event) {
    client.on('copy', function (event) {
        var id = $(event.target).attr('data-id');
        var content = $.trim($('#fe_text_' + id).val());
        event.clipboardData.setData('text/plain', content);
    });

    client.on('aftercopy', function (event) {
        //layer.msg('已经复制到粘贴板!', {icon: 1, time: 1500,});
        alert("复制成功");
    });
});

</script>

举例:

<tr>
  <th scope="col">ID</th>
  <th scope="col">类型/名称</th>
  <th scope="col">推广链接</th>
  <th scope="col">推广文案</th>
  <th scope="col">标签</th>
  <th scope="col">收入明细</th>
</tr>

<volist name=”result” id=”vo”>

<tr>
  <td>{$vo.id}</td>
  <td>[{$vo.type_name}]{$vo.subject}</td>
  <td><input type="text" class="copylj" value="{$vo.new_href}" id="fe_text_{$vo.id}" readonly>
  <span id="clip_button"  data-id="{$vo.id}" style="cursor: pointer;" class="copy fr">复制</span></td>
  <td><a class="down-btn" href="__MODULE__/Center/download/id/{$vo.id}">下载</a></td>
  <td>{$vo.mark_name}</td>
  <td><a class="look-btn" href="__MODULE__/Center/look/id/{$vo.id}">查看</a></td>
</tr>

</volist>
</tbody>
</table>

    原文作者:葡萄酒不吐葡萄皮
    原文地址: https://segmentfault.com/a/1190000009038567
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞