效果图:
实现代码:
1.
<input type="text" id="code" placeholder="注册码" style="width:280px" > <span class="cnblogs_code_copy" style="padding-right:5px;line-height:1.5;">
<a title="复制代码" style="color:rgb(51,153,255);border:none;"
οnclick="copyCode()" target="_blank">
<img src="https://common.cnblogs.com/images/copycode.gif" alt="复制代码"
style="margin-bottom:0px;border:none;">
</a></span>
2.
<script type="text/javascript"> function copyCode() { document.getElementById('code').select(); document.execCommand('Copy'); } </script>