JS实现 点击button(copy) 复制对应的网址——类似于复制推广链接

<form action="">
<input type="text" class="share-input" value="http://www.youtube.com" id="copy-content"/>
<button class="copy-button" type="button" onclick="copyContent();"> 复制 </button>
</form>
<script type="text/javascript">
/*Copy function implementation */
function copyContent(){
var copyobject=document.getElementById("copy-content");
copyobject.select();
document.execCommand("Copy");
alert("已复制成功哦~");
};
</script>
上一篇:SUSE12Sp3安装配置.net core 生产环境(1)-IP,DNS,网关,SSH,GIT


下一篇:Ensures there will be no 'console is undefined' errors