Clipboard.js实现复制内容到剪切板

<script type="text/javascript">
var clipboard1 = new Clipboard('.bt01');
clipboard1.on('success', function (e) {
alert("Copy Url Success!");
e.clearSelection();
});
</script>
<div class="mt5"><img src="../../Images/pdf1.png" class="inline-any"><input type="text" id="hid01" width="100px" value="@ViewBag.Url1" />
<input type="button" value="Copy url" class="btn1 inline-any bt01" data-clipboard-action="copy" data-clipboard-target="#hid01" /></div>

要先添加Clipboard.js的引用

上一篇:DP专题训练之HDU 2955 Robberies


下一篇:DP入门---Robberies